/*
 ------------------------------------------------------------------------------
 Copyright (C) 2006-2007 Team Blur.

 This file is part of the Quantum Engine source code.

 The Quantum Engine source code is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 2 of the License, or (at your
 option) any later version.

 The Quantum Engine source code is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 more details.

 You should have received a copy of the GNU General Public License along with
 the Quantum Engine source code; if not, write to the Free Software Foundation, Inc.,
 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 ------------------------------------------------------------------------------
*/


// win_qgl.cpp -- binding of GL to QGL function pointers


#include "../renderer/r_local.h"
#include "win_local.h"


typedef struct {
	HMODULE			hModule;

	bool			extensionPointers;

	FILE *			logFile;
	char			logFileName[MAX_OSPATH];
	int				logFileFrames;
} qglState_t;

static qglState_t	qglState;


// ============================================================================


int				(WINAPI   * qwglChoosePixelFormat)(HDC hDC, CONST PIXELFORMATDESCRIPTOR *pPFD);
BOOL			(WINAPI   * qwglCopyContext)(HGLRC hGLRCSrc, HGLRC hGLRCDst, UINT mask);
HGLRC			(WINAPI   * qwglCreateContext)(HDC hDC);
HGLRC			(WINAPI   * qwglCreateLayerContext)(HDC hDC, int iLayerPlane);
BOOL			(WINAPI   * qwglDeleteContext)(HGLRC hGLRC);
BOOL			(WINAPI   * qwglDescribeLayerPlane)(HDC hDC, int iPixelFormat, int iLayerPlane, UINT nBytes, LPLAYERPLANEDESCRIPTOR pLPD);
int				(WINAPI   * qwglDescribePixelFormat)(HDC hDC, int iPixelFormat, UINT nBytes, LPPIXELFORMATDESCRIPTOR pPFD);
HGLRC			(WINAPI   * qwglGetCurrentContext)(void);
HDC				(WINAPI   * qwglGetCurrentDC)(void);
int				(WINAPI   * qwglGetLayerPaletteEntries)(HDC hDC, int iLayerPlane, int iStart, int cEntries, COLORREF *pCR);
int				(WINAPI   * qwglGetPixelFormat)(HDC hDC);
PROC			(WINAPI   * qwglGetProcAddress)(LPCSTR lpszProc);
BOOL			(WINAPI   * qwglMakeCurrent)(HDC hDC, HGLRC hGLRC);
BOOL			(WINAPI   * qwglRealizeLayerPalette)(HDC hDC, int iLayerPlane, BOOL bRealize);
int				(WINAPI   * qwglSetLayerPaletteEntries)(HDC hDC, int iLayerPlane, int iStart, int cEntries, CONST COLORREF *pCR);
BOOL			(WINAPI   * qwglSetPixelFormat)(HDC hDC, int iPixelFormat, CONST PIXELFORMATDESCRIPTOR *pPFD);
BOOL			(WINAPI   * qwglShareLists)(HGLRC hGLRC1, HGLRC hGLRC2);
BOOL			(WINAPI   * qwglSwapBuffers)(HDC hDC);
BOOL			(WINAPI   * qwglSwapLayerBuffers)(HDC hDC, UINT fuPlanes);
BOOL			(WINAPI   * qwglUseFontBitmaps)(HDC hDC, DWORD first, DWORD count, DWORD listBase);
BOOL			(WINAPI   * qwglUseFontOutlines)(HDC hDC, DWORD first, DWORD count, DWORD listBase, FLOAT deviation, FLOAT extrusion, int format, LPGLYPHMETRICSFLOAT lpGMF);

GLvoid			(APIENTRY * qglAccum)(GLenum op, GLfloat value);
GLvoid			(APIENTRY * qglAlphaFunc)(GLenum func, GLclampf ref);
GLboolean		(APIENTRY * qglAreTexturesResident)(GLsizei n, const GLuint *textures, GLboolean *residences);
GLvoid			(APIENTRY * qglArrayElement)(GLint i);
GLvoid			(APIENTRY * qglBegin)(GLenum mode);
GLvoid			(APIENTRY * qglBindTexture)(GLenum target, GLuint texture);
GLvoid			(APIENTRY * qglBitmap)(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap);
GLvoid			(APIENTRY * qglBlendFunc)(GLenum sfactor, GLenum dfactor);
GLvoid			(APIENTRY * qglCallList)(GLuint list);
GLvoid			(APIENTRY * qglCallLists)(GLsizei n, GLenum type, const GLvoid *lists);
GLvoid			(APIENTRY * qglClear)(GLbitfield mask);
GLvoid			(APIENTRY * qglClearAccum)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
GLvoid			(APIENTRY * qglClearColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
GLvoid			(APIENTRY * qglClearDepth)(GLclampd depth);
GLvoid			(APIENTRY * qglClearIndex)(GLfloat c);
GLvoid			(APIENTRY * qglClearStencil)(GLint s);
GLvoid			(APIENTRY * qglClipPlane)(GLenum plane, const GLdouble *equation);
GLvoid			(APIENTRY * qglColor3b)(GLbyte red, GLbyte green, GLbyte blue);
GLvoid			(APIENTRY * qglColor3bv)(const GLbyte *v);
GLvoid			(APIENTRY * qglColor3d)(GLdouble red, GLdouble green, GLdouble blue);
GLvoid			(APIENTRY * qglColor3dv)(const GLdouble *v);
GLvoid			(APIENTRY * qglColor3f)(GLfloat red, GLfloat green, GLfloat blue);
GLvoid			(APIENTRY * qglColor3fv)(const GLfloat *v);
GLvoid			(APIENTRY * qglColor3i)(GLint red, GLint green, GLint blue);
GLvoid			(APIENTRY * qglColor3iv)(const GLint *v);
GLvoid			(APIENTRY * qglColor3s)(GLshort red, GLshort green, GLshort blue);
GLvoid			(APIENTRY * qglColor3sv)(const GLshort *v);
GLvoid			(APIENTRY * qglColor3ub)(GLubyte red, GLubyte green, GLubyte blue);
GLvoid			(APIENTRY * qglColor3ubv)(const GLubyte *v);
GLvoid			(APIENTRY * qglColor3ui)(GLuint red, GLuint green, GLuint blue);
GLvoid			(APIENTRY * qglColor3uiv)(const GLuint *v);
GLvoid			(APIENTRY * qglColor3us)(GLushort red, GLushort green, GLushort blue);
GLvoid			(APIENTRY * qglColor3usv)(const GLushort *v);
GLvoid			(APIENTRY * qglColor4b)(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha);
GLvoid			(APIENTRY * qglColor4bv)(const GLbyte *v);
GLvoid			(APIENTRY * qglColor4d)(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha);
GLvoid			(APIENTRY * qglColor4dv)(const GLdouble *v);
GLvoid			(APIENTRY * qglColor4f)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
GLvoid			(APIENTRY * qglColor4fv)(const GLfloat *v);
GLvoid			(APIENTRY * qglColor4i)(GLint red, GLint green, GLint blue, GLint alpha);
GLvoid			(APIENTRY * qglColor4iv)(const GLint *v);
GLvoid			(APIENTRY * qglColor4s)(GLshort red, GLshort green, GLshort blue, GLshort alpha);
GLvoid			(APIENTRY * qglColor4sv)(const GLshort *v);
GLvoid			(APIENTRY * qglColor4ub)(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
GLvoid			(APIENTRY * qglColor4ubv)(const GLubyte *v);
GLvoid			(APIENTRY * qglColor4ui)(GLuint red, GLuint green, GLuint blue, GLuint alpha);
GLvoid			(APIENTRY * qglColor4uiv)(const GLuint *v);
GLvoid			(APIENTRY * qglColor4us)(GLushort red, GLushort green, GLushort blue, GLushort alpha);
GLvoid			(APIENTRY * qglColor4usv)(const GLushort *v);
GLvoid			(APIENTRY * qglColorMask)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
GLvoid			(APIENTRY * qglColorMaterial)(GLenum face, GLenum mode);
GLvoid			(APIENTRY * qglColorPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
GLvoid			(APIENTRY * qglCopyPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type);
GLvoid			(APIENTRY * qglCopyTexImage1D)(GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border);
GLvoid			(APIENTRY * qglCopyTexImage2D)(GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
GLvoid			(APIENTRY * qglCopyTexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
GLvoid			(APIENTRY * qglCopyTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
GLvoid			(APIENTRY * qglCullFace)(GLenum mode);
GLvoid			(APIENTRY * qglDeleteLists)(GLuint list, GLsizei range);
GLvoid			(APIENTRY * qglDeleteTextures)(GLsizei n, const GLuint *textures);
GLvoid			(APIENTRY * qglDepthFunc)(GLenum func);
GLvoid			(APIENTRY * qglDepthMask)(GLboolean flag);
GLvoid			(APIENTRY * qglDepthRange)(GLclampd zNear, GLclampd zFar);
GLvoid			(APIENTRY * qglDisable)(GLenum cap);
GLvoid			(APIENTRY * qglDisableClientState)(GLenum array);
GLvoid			(APIENTRY * qglDrawArrays)(GLenum mode, GLint first, GLsizei count);
GLvoid			(APIENTRY * qglDrawBuffer)(GLenum mode);
GLvoid			(APIENTRY * qglDrawElements)(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
GLvoid			(APIENTRY * qglDrawPixels)(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
GLvoid			(APIENTRY * qglEdgeFlag)(GLboolean flag);
GLvoid			(APIENTRY * qglEdgeFlagPointer)(GLsizei stride, const GLvoid *pointer);
GLvoid			(APIENTRY * qglEdgeFlagv)(const GLboolean *flag);
GLvoid			(APIENTRY * qglEnable)(GLenum cap);
GLvoid			(APIENTRY * qglEnableClientState)(GLenum array);
GLvoid			(APIENTRY * qglEnd)(GLvoid);
GLvoid			(APIENTRY * qglEndList)(GLvoid);
GLvoid			(APIENTRY * qglEvalCoord1d)(GLdouble u);
GLvoid			(APIENTRY * qglEvalCoord1dv)(const GLdouble *u);
GLvoid			(APIENTRY * qglEvalCoord1f)(GLfloat u);
GLvoid			(APIENTRY * qglEvalCoord1fv)(const GLfloat *u);
GLvoid			(APIENTRY * qglEvalCoord2d)(GLdouble u, GLdouble v);
GLvoid			(APIENTRY * qglEvalCoord2dv)(const GLdouble *u);
GLvoid			(APIENTRY * qglEvalCoord2f)(GLfloat u, GLfloat v);
GLvoid			(APIENTRY * qglEvalCoord2fv)(const GLfloat *u);
GLvoid			(APIENTRY * qglEvalMesh1)(GLenum mode, GLint i1, GLint i2);
GLvoid			(APIENTRY * qglEvalMesh2)(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2);
GLvoid			(APIENTRY * qglEvalPoint1)(GLint i);
GLvoid			(APIENTRY * qglEvalPoint2)(GLint i, GLint j);
GLvoid			(APIENTRY * qglFeedbackBuffer)(GLsizei size, GLenum type, GLfloat *buffer);
GLvoid			(APIENTRY * qglFinish)(GLvoid);
GLvoid			(APIENTRY * qglFlush)(GLvoid);
GLvoid			(APIENTRY * qglFogf)(GLenum pname, GLfloat param);
GLvoid			(APIENTRY * qglFogfv)(GLenum pname, const GLfloat *params);
GLvoid			(APIENTRY * qglFogi)(GLenum pname, GLint param);
GLvoid			(APIENTRY * qglFogiv)(GLenum pname, const GLint *params);
GLvoid			(APIENTRY * qglFrontFace)(GLenum mode);
GLvoid			(APIENTRY * qglFrustum)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
GLuint			(APIENTRY * qglGenLists)(GLsizei range);
GLvoid			(APIENTRY * qglGenTextures)(GLsizei n, GLuint *textures);
GLvoid			(APIENTRY * qglGetBooleanv)(GLenum pname, GLboolean *params);
GLvoid			(APIENTRY * qglGetClipPlane)(GLenum plane, GLdouble *equation);
GLvoid			(APIENTRY * qglGetDoublev)(GLenum pname, GLdouble *params);
GLenum			(APIENTRY * qglGetError)(GLvoid);
GLvoid			(APIENTRY * qglGetFloatv)(GLenum pname, GLfloat *params);
GLvoid			(APIENTRY * qglGetIntegerv)(GLenum pname, GLint *params);
GLvoid			(APIENTRY * qglGetLightfv)(GLenum light, GLenum pname, GLfloat *params);
GLvoid			(APIENTRY * qglGetLightiv)(GLenum light, GLenum pname, GLint *params);
GLvoid			(APIENTRY * qglGetMapdv)(GLenum target, GLenum query, GLdouble *v);
GLvoid			(APIENTRY * qglGetMapfv)(GLenum target, GLenum query, GLfloat *v);
GLvoid			(APIENTRY * qglGetMapiv)(GLenum target, GLenum query, GLint *v);
GLvoid			(APIENTRY * qglGetMaterialfv)(GLenum face, GLenum pname, GLfloat *params);
GLvoid			(APIENTRY * qglGetMaterialiv)(GLenum face, GLenum pname, GLint *params);
GLvoid			(APIENTRY * qglGetPixelMapfv)(GLenum map, GLfloat *values);
GLvoid			(APIENTRY * qglGetPixelMapuiv)(GLenum map, GLuint *values);
GLvoid			(APIENTRY * qglGetPixelMapusv)(GLenum map, GLushort *values);
GLvoid			(APIENTRY * qglGetPointerv)(GLenum pname, GLvoid **params);
GLvoid			(APIENTRY * qglGetPolygonStipple)(GLubyte *mask);
const GLubyte *	(APIENTRY * qglGetString)(GLenum name);
GLvoid			(APIENTRY * qglGetTexEnvfv)(GLenum target, GLenum pname, GLfloat *params);
GLvoid			(APIENTRY * qglGetTexEnviv)(GLenum target, GLenum pname, GLint *params);
GLvoid			(APIENTRY * qglGetTexGendv)(GLenum coord, GLenum pname, GLdouble *params);
GLvoid			(APIENTRY * qglGetTexGenfv)(GLenum coord, GLenum pname, GLfloat *params);
GLvoid			(APIENTRY * qglGetTexGeniv)(GLenum coord, GLenum pname, GLint *params);
GLvoid			(APIENTRY * qglGetTexImage)(GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels);
GLvoid			(APIENTRY * qglGetTexLevelParameterfv)(GLenum target, GLint level, GLenum pname, GLfloat *params);
GLvoid			(APIENTRY * qglGetTexLevelParameteriv)(GLenum target, GLint level, GLenum pname, GLint *params);
GLvoid			(APIENTRY * qglGetTexParameterfv)(GLenum target, GLenum pname, GLfloat *params);
GLvoid			(APIENTRY * qglGetTexParameteriv)(GLenum target, GLenum pname, GLint *params);
GLvoid			(APIENTRY * qglHint)(GLenum target, GLenum mode);
GLvoid			(APIENTRY * qglIndexMask)(GLuint mask);
GLvoid			(APIENTRY * qglIndexPointer)(GLenum type, GLsizei stride, const GLvoid *pointer);
GLvoid			(APIENTRY * qglIndexd)(GLdouble c);
GLvoid			(APIENTRY * qglIndexdv)(const GLdouble *c);
GLvoid			(APIENTRY * qglIndexf)(GLfloat c);
GLvoid			(APIENTRY * qglIndexfv)(const GLfloat *c);
GLvoid			(APIENTRY * qglIndexi)(GLint c);
GLvoid			(APIENTRY * qglIndexiv)(const GLint *c);
GLvoid			(APIENTRY * qglIndexs)(GLshort c);
GLvoid			(APIENTRY * qglIndexsv)(const GLshort *c);
GLvoid			(APIENTRY * qglIndexub)(GLubyte c);
GLvoid			(APIENTRY * qglIndexubv)(const GLubyte *c);
GLvoid			(APIENTRY * qglInitNames)(GLvoid);
GLvoid			(APIENTRY * qglInterleavedArrays)(GLenum format, GLsizei stride, const GLvoid *pointer);
GLboolean		(APIENTRY * qglIsEnabled)(GLenum cap);
GLboolean		(APIENTRY * qglIsList)(GLuint list);
GLboolean		(APIENTRY * qglIsTexture)(GLuint texture);
GLvoid			(APIENTRY * qglLightModelf)(GLenum pname, GLfloat param);
GLvoid			(APIENTRY * qglLightModelfv)(GLenum pname, const GLfloat *params);
GLvoid			(APIENTRY * qglLightModeli)(GLenum pname, GLint param);
GLvoid			(APIENTRY * qglLightModeliv)(GLenum pname, const GLint *params);
GLvoid			(APIENTRY * qglLightf)(GLenum light, GLenum pname, GLfloat param);
GLvoid			(APIENTRY * qglLightfv)(GLenum light, GLenum pname, const GLfloat *params);
GLvoid			(APIENTRY * qglLighti)(GLenum light, GLenum pname, GLint param);
GLvoid			(APIENTRY * qglLightiv)(GLenum light, GLenum pname, const GLint *params);
GLvoid			(APIENTRY * qglLineStipple)(GLint factor, GLushort pattern);
GLvoid			(APIENTRY * qglLineWidth)(GLfloat width);
GLvoid			(APIENTRY * qglListBase)(GLuint base);
GLvoid			(APIENTRY * qglLoadIdentity)(GLvoid);
GLvoid			(APIENTRY * qglLoadMatrixd)(const GLdouble *m);
GLvoid			(APIENTRY * qglLoadMatrixf)(const GLfloat *m);
GLvoid			(APIENTRY * qglLoadName)(GLuint name);
GLvoid			(APIENTRY * qglLogicOp)(GLenum opcode);
GLvoid			(APIENTRY * qglMap1d)(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points);
GLvoid			(APIENTRY * qglMap1f)(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points);
GLvoid			(APIENTRY * qglMap2d)(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points);
GLvoid			(APIENTRY * qglMap2f)(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points);
GLvoid			(APIENTRY * qglMapGrid1d)(GLint un, GLdouble u1, GLdouble u2);
GLvoid			(APIENTRY * qglMapGrid1f)(GLint un, GLfloat u1, GLfloat u2);
GLvoid			(APIENTRY * qglMapGrid2d)(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2);
GLvoid			(APIENTRY * qglMapGrid2f)(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2);
GLvoid			(APIENTRY * qglMaterialf)(GLenum face, GLenum pname, GLfloat param);
GLvoid			(APIENTRY * qglMaterialfv)(GLenum face, GLenum pname, const GLfloat *params);
GLvoid			(APIENTRY * qglMateriali)(GLenum face, GLenum pname, GLint param);
GLvoid			(APIENTRY * qglMaterialiv)(GLenum face, GLenum pname, const GLint *params);
GLvoid			(APIENTRY * qglMatrixMode)(GLenum mode);
GLvoid			(APIENTRY * qglMultMatrixd)(const GLdouble *m);
GLvoid			(APIENTRY * qglMultMatrixf)(const GLfloat *m);
GLvoid			(APIENTRY * qglNewList)(GLuint list, GLenum mode);
GLvoid			(APIENTRY * qglNormal3b)(GLbyte nx, GLbyte ny, GLbyte nz);
GLvoid			(APIENTRY * qglNormal3bv)(const GLbyte *v);
GLvoid			(APIENTRY * qglNormal3d)(GLdouble nx, GLdouble ny, GLdouble nz);
GLvoid			(APIENTRY * qglNormal3dv)(const GLdouble *v);
GLvoid			(APIENTRY * qglNormal3f)(GLfloat nx, GLfloat ny, GLfloat nz);
GLvoid			(APIENTRY * qglNormal3fv)(const GLfloat *v);
GLvoid			(APIENTRY * qglNormal3i)(GLint nx, GLint ny, GLint nz);
GLvoid			(APIENTRY * qglNormal3iv)(const GLint *v);
GLvoid			(APIENTRY * qglNormal3s)(GLshort nx, GLshort ny, GLshort nz);
GLvoid			(APIENTRY * qglNormal3sv)(const GLshort *v);
GLvoid			(APIENTRY * qglNormalPointer)(GLenum type, GLsizei stride, const GLvoid *pointer);
GLvoid			(APIENTRY * qglOrtho)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
GLvoid			(APIENTRY * qglPassThrough)(GLfloat token);
GLvoid			(APIENTRY * qglPixelMapfv)(GLenum map, GLsizei mapsize, const GLfloat *values);
GLvoid			(APIENTRY * qglPixelMapuiv)(GLenum map, GLsizei mapsize, const GLuint *values);
GLvoid			(APIENTRY * qglPixelMapusv)(GLenum map, GLsizei mapsize, const GLushort *values);
GLvoid			(APIENTRY * qglPixelStoref)(GLenum pname, GLfloat param);
GLvoid			(APIENTRY * qglPixelStorei)(GLenum pname, GLint param);
GLvoid			(APIENTRY * qglPixelTransferf)(GLenum pname, GLfloat param);
GLvoid			(APIENTRY * qglPixelTransferi)(GLenum pname, GLint param);
GLvoid			(APIENTRY * qglPixelZoom)(GLfloat xfactor, GLfloat yfactor);
GLvoid			(APIENTRY * qglPointSize)(GLfloat size);
GLvoid			(APIENTRY * qglPolygonMode)(GLenum face, GLenum mode);
GLvoid			(APIENTRY * qglPolygonOffset)(GLfloat factor, GLfloat units);
GLvoid			(APIENTRY * qglPolygonStipple)(const GLubyte *mask);
GLvoid			(APIENTRY * qglPopAttrib)(GLvoid);
GLvoid			(APIENTRY * qglPopClientAttrib)(GLvoid);
GLvoid			(APIENTRY * qglPopMatrix)(GLvoid);
GLvoid			(APIENTRY * qglPopName)(GLvoid);
GLvoid			(APIENTRY * qglPrioritizeTextures)(GLsizei n, const GLuint *textures, const GLclampf *priorities);
GLvoid			(APIENTRY * qglPushAttrib)(GLbitfield mask);
GLvoid			(APIENTRY * qglPushClientAttrib)(GLbitfield mask);
GLvoid			(APIENTRY * qglPushMatrix)(GLvoid);
GLvoid			(APIENTRY * qglPushName)(GLuint name);
GLvoid			(APIENTRY * qglRasterPos2d)(GLdouble x, GLdouble y);
GLvoid			(APIENTRY * qglRasterPos2dv)(const GLdouble *v);
GLvoid			(APIENTRY * qglRasterPos2f)(GLfloat x, GLfloat y);
GLvoid			(APIENTRY * qglRasterPos2fv)(const GLfloat *v);
GLvoid			(APIENTRY * qglRasterPos2i)(GLint x, GLint y);
GLvoid			(APIENTRY * qglRasterPos2iv)(const GLint *v);
GLvoid			(APIENTRY * qglRasterPos2s)(GLshort x, GLshort y);
GLvoid			(APIENTRY * qglRasterPos2sv)(const GLshort *v);
GLvoid			(APIENTRY * qglRasterPos3d)(GLdouble x, GLdouble y, GLdouble z);
GLvoid			(APIENTRY * qglRasterPos3dv)(const GLdouble *v);
GLvoid			(APIENTRY * qglRasterPos3f)(GLfloat x, GLfloat y, GLfloat z);
GLvoid			(APIENTRY * qglRasterPos3fv)(const GLfloat *v);
GLvoid			(APIENTRY * qglRasterPos3i)(GLint x, GLint y, GLint z);
GLvoid			(APIENTRY * qglRasterPos3iv)(const GLint *v);
GLvoid			(APIENTRY * qglRasterPos3s)(GLshort x, GLshort y, GLshort z);
GLvoid			(APIENTRY * qglRasterPos3sv)(const GLshort *v);
GLvoid			(APIENTRY * qglRasterPos4d)(GLdouble x, GLdouble y, GLdouble z, GLdouble w);
GLvoid			(APIENTRY * qglRasterPos4dv)(const GLdouble *v);
GLvoid			(APIENTRY * qglRasterPos4f)(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
GLvoid			(APIENTRY * qglRasterPos4fv)(const GLfloat *v);
GLvoid			(APIENTRY * qglRasterPos4i)(GLint x, GLint y, GLint z, GLint w);
GLvoid			(APIENTRY * qglRasterPos4iv)(const GLint *v);
GLvoid			(APIENTRY * qglRasterPos4s)(GLshort x, GLshort y, GLshort z, GLshort w);
GLvoid			(APIENTRY * qglRasterPos4sv)(const GLshort *v);
GLvoid			(APIENTRY * qglReadBuffer)(GLenum mode);
GLvoid			(APIENTRY * qglReadPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);
GLvoid			(APIENTRY * qglRectd)(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2);
GLvoid			(APIENTRY * qglRectdv)(const GLdouble *v1, const GLdouble *v2);
GLvoid			(APIENTRY * qglRectf)(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2);
GLvoid			(APIENTRY * qglRectfv)(const GLfloat *v1, const GLfloat *v2);
GLvoid			(APIENTRY * qglRecti)(GLint x1, GLint y1, GLint x2, GLint y2);
GLvoid			(APIENTRY * qglRectiv)(const GLint *v1, const GLint *v2);
GLvoid			(APIENTRY * qglRects)(GLshort x1, GLshort y1, GLshort x2, GLshort y2);
GLvoid			(APIENTRY * qglRectsv)(const GLshort *v1, const GLshort *v2);
GLint			(APIENTRY * qglRenderMode)(GLenum mode);
GLvoid			(APIENTRY * qglRotated)(GLdouble angle, GLdouble x, GLdouble y, GLdouble z);
GLvoid			(APIENTRY * qglRotatef)(GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
GLvoid			(APIENTRY * qglScaled)(GLdouble x, GLdouble y, GLdouble z);
GLvoid			(APIENTRY * qglScalef)(GLfloat x, GLfloat y, GLfloat z);
GLvoid			(APIENTRY * qglScissor)(GLint x, GLint y, GLsizei width, GLsizei height);
GLvoid			(APIENTRY * qglSelectBuffer)(GLsizei size, GLuint *buffer);
GLvoid			(APIENTRY * qglShadeModel)(GLenum mode);
GLvoid			(APIENTRY * qglStencilFunc)(GLenum func, GLint ref, GLuint mask);
GLvoid			(APIENTRY * qglStencilMask)(GLuint mask);
GLvoid			(APIENTRY * qglStencilOp)(GLenum fail, GLenum zfail, GLenum zpass);
GLvoid			(APIENTRY * qglTexCoord1d)(GLdouble s);
GLvoid			(APIENTRY * qglTexCoord1dv)(const GLdouble *v);
GLvoid			(APIENTRY * qglTexCoord1f)(GLfloat s);
GLvoid			(APIENTRY * qglTexCoord1fv)(const GLfloat *v);
GLvoid			(APIENTRY * qglTexCoord1i)(GLint s);
GLvoid			(APIENTRY * qglTexCoord1iv)(const GLint *v);
GLvoid			(APIENTRY * qglTexCoord1s)(GLshort s);
GLvoid			(APIENTRY * qglTexCoord1sv)(const GLshort *v);
GLvoid			(APIENTRY * qglTexCoord2d)(GLdouble s, GLdouble t);
GLvoid			(APIENTRY * qglTexCoord2dv)(const GLdouble *v);
GLvoid			(APIENTRY * qglTexCoord2f)(GLfloat s, GLfloat t);
GLvoid			(APIENTRY * qglTexCoord2fv)(const GLfloat *v);
GLvoid			(APIENTRY * qglTexCoord2i)(GLint s, GLint t);
GLvoid			(APIENTRY * qglTexCoord2iv)(const GLint *v);
GLvoid			(APIENTRY * qglTexCoord2s)(GLshort s, GLshort t);
GLvoid			(APIENTRY * qglTexCoord2sv)(const GLshort *v);
GLvoid			(APIENTRY * qglTexCoord3d)(GLdouble s, GLdouble t, GLdouble r);
GLvoid			(APIENTRY * qglTexCoord3dv)(const GLdouble *v);
GLvoid			(APIENTRY * qglTexCoord3f)(GLfloat s, GLfloat t, GLfloat r);
GLvoid			(APIENTRY * qglTexCoord3fv)(const GLfloat *v);
GLvoid			(APIENTRY * qglTexCoord3i)(GLint s, GLint t, GLint r);
GLvoid			(APIENTRY * qglTexCoord3iv)(const GLint *v);
GLvoid			(APIENTRY * qglTexCoord3s)(GLshort s, GLshort t, GLshort r);
GLvoid			(APIENTRY * qglTexCoord3sv)(const GLshort *v);
GLvoid			(APIENTRY * qglTexCoord4d)(GLdouble s, GLdouble t, GLdouble r, GLdouble q);
GLvoid			(APIENTRY * qglTexCoord4dv)(const GLdouble *v);
GLvoid			(APIENTRY * qglTexCoord4f)(GLfloat s, GLfloat t, GLfloat r, GLfloat q);
GLvoid			(APIENTRY * qglTexCoord4fv)(const GLfloat *v);
GLvoid			(APIENTRY * qglTexCoord4i)(GLint s, GLint t, GLint r, GLint q);
GLvoid			(APIENTRY * qglTexCoord4iv)(const GLint *v);
GLvoid			(APIENTRY * qglTexCoord4s)(GLshort s, GLshort t, GLshort r, GLshort q);
GLvoid			(APIENTRY * qglTexCoord4sv)(const GLshort *v);
GLvoid			(APIENTRY * qglTexCoordPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
GLvoid			(APIENTRY * qglTexEnvf)(GLenum target, GLenum pname, GLfloat param);
GLvoid			(APIENTRY * qglTexEnvfv)(GLenum target, GLenum pname, const GLfloat *params);
GLvoid			(APIENTRY * qglTexEnvi)(GLenum target, GLenum pname, GLint param);
GLvoid			(APIENTRY * qglTexEnviv)(GLenum target, GLenum pname, const GLint *params);
GLvoid			(APIENTRY * qglTexGend)(GLenum coord, GLenum pname, GLdouble param);
GLvoid			(APIENTRY * qglTexGendv)(GLenum coord, GLenum pname, const GLdouble *params);
GLvoid			(APIENTRY * qglTexGenf)(GLenum coord, GLenum pname, GLfloat param);
GLvoid			(APIENTRY * qglTexGenfv)(GLenum coord, GLenum pname, const GLfloat *params);
GLvoid			(APIENTRY * qglTexGeni)(GLenum coord, GLenum pname, GLint param);
GLvoid			(APIENTRY * qglTexGeniv)(GLenum coord, GLenum pname, const GLint *params);
GLvoid			(APIENTRY * qglTexImage1D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
GLvoid			(APIENTRY * qglTexImage2D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
GLvoid			(APIENTRY * qglTexParameterf)(GLenum target, GLenum pname, GLfloat param);
GLvoid			(APIENTRY * qglTexParameterfv)(GLenum target, GLenum pname, const GLfloat *params);
GLvoid			(APIENTRY * qglTexParameteri)(GLenum target, GLenum pname, GLint param);
GLvoid			(APIENTRY * qglTexParameteriv)(GLenum target, GLenum pname, const GLint *params);
GLvoid			(APIENTRY * qglTexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels);
GLvoid			(APIENTRY * qglTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
GLvoid			(APIENTRY * qglTranslated)(GLdouble x, GLdouble y, GLdouble z);
GLvoid			(APIENTRY * qglTranslatef)(GLfloat x, GLfloat y, GLfloat z);
GLvoid			(APIENTRY * qglVertex2d)(GLdouble x, GLdouble y);
GLvoid			(APIENTRY * qglVertex2dv)(const GLdouble *v);
GLvoid			(APIENTRY * qglVertex2f)(GLfloat x, GLfloat y);
GLvoid			(APIENTRY * qglVertex2fv)(const GLfloat *v);
GLvoid			(APIENTRY * qglVertex2i)(GLint x, GLint y);
GLvoid			(APIENTRY * qglVertex2iv)(const GLint *v);
GLvoid			(APIENTRY * qglVertex2s)(GLshort x, GLshort y);
GLvoid			(APIENTRY * qglVertex2sv)(const GLshort *v);
GLvoid			(APIENTRY * qglVertex3d)(GLdouble x, GLdouble y, GLdouble z);
GLvoid			(APIENTRY * qglVertex3dv)(const GLdouble *v);
GLvoid			(APIENTRY * qglVertex3f)(GLfloat x, GLfloat y, GLfloat z);
GLvoid			(APIENTRY * qglVertex3fv)(const GLfloat *v);
GLvoid			(APIENTRY * qglVertex3i)(GLint x, GLint y, GLint z);
GLvoid			(APIENTRY * qglVertex3iv)(const GLint *v);
GLvoid			(APIENTRY * qglVertex3s)(GLshort x, GLshort y, GLshort z);
GLvoid			(APIENTRY * qglVertex3sv)(const GLshort *v);
GLvoid			(APIENTRY * qglVertex4d)(GLdouble x, GLdouble y, GLdouble z, GLdouble w);
GLvoid			(APIENTRY * qglVertex4dv)(const GLdouble *v);
GLvoid			(APIENTRY * qglVertex4f)(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
GLvoid			(APIENTRY * qglVertex4fv)(const GLfloat *v);
GLvoid			(APIENTRY * qglVertex4i)(GLint x, GLint y, GLint z, GLint w);
GLvoid			(APIENTRY * qglVertex4iv)(const GLint *v);
GLvoid			(APIENTRY * qglVertex4s)(GLshort x, GLshort y, GLshort z, GLshort w);
GLvoid			(APIENTRY * qglVertex4sv)(const GLshort *v);
GLvoid			(APIENTRY * qglVertexPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
GLvoid			(APIENTRY * qglViewport)(GLint x, GLint y, GLsizei width, GLsizei height);

GLvoid			(APIENTRY * qglActiveTexture)(GLenum texture);

GLvoid			(APIENTRY * qglGenBuffers)(GLsizei n, GLuint *buffers);
GLvoid			(APIENTRY * qglDeleteBuffers)(GLsizei n, const GLuint *buffers);
GLvoid			(APIENTRY * qglBindBuffer)(GLenum target, GLuint buffer);
GLvoid			(APIENTRY * qglBufferData)(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage);
GLvoid			(APIENTRY * qglBufferSubData)(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data);
GLvoid *		(APIENTRY * qglMapBuffer)(GLenum target, GLenum access);
GLboolean		(APIENTRY * qglUnmapBuffer)(GLenum target);

GLuint			(APIENTRY * qglCreateShader)(GLenum type);
GLuint			(APIENTRY * qglCreateProgram)(GLvoid);
GLvoid			(APIENTRY * qglDeleteShader)(GLuint shader);
GLvoid			(APIENTRY * qglDeleteProgram)(GLuint program);
GLvoid			(APIENTRY * qglGetShaderiv)(GLuint shader, GLenum pname, GLint *params);
GLvoid			(APIENTRY * qglGetProgramiv)(GLuint program, GLenum pname, GLint *params);
GLvoid			(APIENTRY * qglGetShaderInfoLog)(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
GLvoid			(APIENTRY * qglGetProgramInfoLog)(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
GLvoid			(APIENTRY * qglShaderSource)(GLuint shader, GLsizei count, const GLchar **string, const GLint *length);
GLvoid			(APIENTRY * qglCompileShader)(GLuint shader);
GLvoid			(APIENTRY * qglAttachShader)(GLuint program, GLuint shader);
GLvoid			(APIENTRY * qglDetachShader)(GLuint program, GLuint shader);
GLvoid			(APIENTRY * qglLinkProgram)(GLuint program);
GLvoid			(APIENTRY * qglUseProgram)(GLuint program);
GLvoid			(APIENTRY * qglVertexAttribPointer)(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer);
GLvoid			(APIENTRY * qglEnableVertexAttribArray)(GLuint index);
GLvoid			(APIENTRY * qglDisableVertexAttribArray)(GLuint index);
GLvoid			(APIENTRY * qglBindAttribLocation)(GLuint program, GLuint index, const GLchar *name);
GLint			(APIENTRY * qglGetAttribLocation)(GLuint program, const GLchar *name);
GLvoid			(APIENTRY * qglGetActiveUniform)(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
GLint			(APIENTRY * qglGetUniformLocation)(GLuint program, const GLchar *name);
GLvoid			(APIENTRY * qglUniform1f)(GLint location, GLfloat v0);
GLvoid			(APIENTRY * qglUniform2f)(GLint location, GLfloat v0, GLfloat v1);
GLvoid			(APIENTRY * qglUniform3f)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
GLvoid			(APIENTRY * qglUniform4f)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
GLvoid			(APIENTRY * qglUniform1i)(GLint location, GLint v0);
GLvoid			(APIENTRY * qglUniform2i)(GLint location, GLint v0, GLint v1);
GLvoid			(APIENTRY * qglUniform3i)(GLint location, GLint v0, GLint v1, GLint v2);
GLvoid			(APIENTRY * qglUniform4i)(GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
GLvoid			(APIENTRY * qglUniform1fv)(GLint location, GLsizei count, const GLfloat *value);
GLvoid			(APIENTRY * qglUniform2fv)(GLint location, GLsizei count, const GLfloat *value);
GLvoid			(APIENTRY * qglUniform3fv)(GLint location, GLsizei count, const GLfloat *value);
GLvoid			(APIENTRY * qglUniform4fv)(GLint location, GLsizei count, const GLfloat *value);
GLvoid			(APIENTRY * qglUniform1iv)(GLint location, GLsizei count, const GLint *value);
GLvoid			(APIENTRY * qglUniform2iv)(GLint location, GLsizei count, const GLint *value);
GLvoid			(APIENTRY * qglUniform3iv)(GLint location, GLsizei count, const GLint *value);
GLvoid			(APIENTRY * qglUniform4iv)(GLint location, GLsizei count, const GLint *value);
GLvoid			(APIENTRY * qglUniformMatrix2fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
GLvoid			(APIENTRY * qglUniformMatrix3fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
GLvoid			(APIENTRY * qglUniformMatrix4fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);

GLvoid			(APIENTRY * qglStencilFuncSeparate)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask);
GLvoid			(APIENTRY * qglStencilOpSeparate)(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
GLvoid			(APIENTRY * qglStencilMaskSeparate)(GLenum face, GLuint mask);

GLvoid			(APIENTRY * qglDepthBoundsEXT)(GLclampd zmin, GLclampd zmax);

BOOL			(WINAPI   * qwglSwapIntervalEXT)(int interval);


// ============================================================================


static GLvoid			(APIENTRY * dllAccum)(GLenum op, GLfloat value);
static GLvoid 			(APIENTRY * dllAlphaFunc)(GLenum func, GLclampf ref);
static GLboolean		(APIENTRY * dllAreTexturesResident)(GLsizei n, const GLuint *textures, GLboolean *residences);
static GLvoid 			(APIENTRY * dllArrayElement)(GLint i);
static GLvoid 			(APIENTRY * dllBegin)(GLenum mode);
static GLvoid 			(APIENTRY * dllBindTexture)(GLenum target, GLuint texture);
static GLvoid 			(APIENTRY * dllBitmap)(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap);
static GLvoid 			(APIENTRY * dllBlendFunc)(GLenum sfactor, GLenum dfactor);
static GLvoid 			(APIENTRY * dllCallList)(GLuint list);
static GLvoid 			(APIENTRY * dllCallLists)(GLsizei n, GLenum type, const GLvoid *lists);
static GLvoid 			(APIENTRY * dllClear)(GLbitfield mask);
static GLvoid 			(APIENTRY * dllClearAccum)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
static GLvoid 			(APIENTRY * dllClearColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
static GLvoid 			(APIENTRY * dllClearDepth)(GLclampd depth);
static GLvoid 			(APIENTRY * dllClearIndex)(GLfloat c);
static GLvoid 			(APIENTRY * dllClearStencil)(GLint s);
static GLvoid 			(APIENTRY * dllClipPlane)(GLenum plane, const GLdouble *equation);
static GLvoid 			(APIENTRY * dllColor3b)(GLbyte red, GLbyte green, GLbyte blue);
static GLvoid 			(APIENTRY * dllColor3bv)(const GLbyte *v);
static GLvoid 			(APIENTRY * dllColor3d)(GLdouble red, GLdouble green, GLdouble blue);
static GLvoid 			(APIENTRY * dllColor3dv)(const GLdouble *v);
static GLvoid 			(APIENTRY * dllColor3f)(GLfloat red, GLfloat green, GLfloat blue);
static GLvoid 			(APIENTRY * dllColor3fv)(const GLfloat *v);
static GLvoid 			(APIENTRY * dllColor3i)(GLint red, GLint green, GLint blue);
static GLvoid 			(APIENTRY * dllColor3iv)(const GLint *v);
static GLvoid 			(APIENTRY * dllColor3s)(GLshort red, GLshort green, GLshort blue);
static GLvoid 			(APIENTRY * dllColor3sv)(const GLshort *v);
static GLvoid 			(APIENTRY * dllColor3ub)(GLubyte red, GLubyte green, GLubyte blue);
static GLvoid 			(APIENTRY * dllColor3ubv)(const GLubyte *v);
static GLvoid 			(APIENTRY * dllColor3ui)(GLuint red, GLuint green, GLuint blue);
static GLvoid 			(APIENTRY * dllColor3uiv)(const GLuint *v);
static GLvoid 			(APIENTRY * dllColor3us)(GLushort red, GLushort green, GLushort blue);
static GLvoid 			(APIENTRY * dllColor3usv)(const GLushort *v);
static GLvoid 			(APIENTRY * dllColor4b)(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha);
static GLvoid 			(APIENTRY * dllColor4bv)(const GLbyte *v);
static GLvoid 			(APIENTRY * dllColor4d)(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha);
static GLvoid 			(APIENTRY * dllColor4dv)(const GLdouble *v);
static GLvoid 			(APIENTRY * dllColor4f)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
static GLvoid 			(APIENTRY * dllColor4fv)(const GLfloat *v);
static GLvoid 			(APIENTRY * dllColor4i)(GLint red, GLint green, GLint blue, GLint alpha);
static GLvoid 			(APIENTRY * dllColor4iv)(const GLint *v);
static GLvoid 			(APIENTRY * dllColor4s)(GLshort red, GLshort green, GLshort blue, GLshort alpha);
static GLvoid 			(APIENTRY * dllColor4sv)(const GLshort *v);
static GLvoid 			(APIENTRY * dllColor4ub)(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
static GLvoid 			(APIENTRY * dllColor4ubv)(const GLubyte *v);
static GLvoid 			(APIENTRY * dllColor4ui)(GLuint red, GLuint green, GLuint blue, GLuint alpha);
static GLvoid 			(APIENTRY * dllColor4uiv)(const GLuint *v);
static GLvoid 			(APIENTRY * dllColor4us)(GLushort red, GLushort green, GLushort blue, GLushort alpha);
static GLvoid 			(APIENTRY * dllColor4usv)(const GLushort *v);
static GLvoid 			(APIENTRY * dllColorMask)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
static GLvoid 			(APIENTRY * dllColorMaterial)(GLenum face, GLenum mode);
static GLvoid 			(APIENTRY * dllColorPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
static GLvoid 			(APIENTRY * dllCopyPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type);
static GLvoid 			(APIENTRY * dllCopyTexImage1D)(GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border);
static GLvoid 			(APIENTRY * dllCopyTexImage2D)(GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
static GLvoid 			(APIENTRY * dllCopyTexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
static GLvoid 			(APIENTRY * dllCopyTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
static GLvoid 			(APIENTRY * dllCullFace)(GLenum mode);
static GLvoid 			(APIENTRY * dllDeleteLists)(GLuint list, GLsizei range);
static GLvoid 			(APIENTRY * dllDeleteTextures)(GLsizei n, const GLuint *textures);
static GLvoid 			(APIENTRY * dllDepthFunc)(GLenum func);
static GLvoid 			(APIENTRY * dllDepthMask)(GLboolean flag);
static GLvoid 			(APIENTRY * dllDepthRange)(GLclampd zNear, GLclampd zFar);
static GLvoid 			(APIENTRY * dllDisable)(GLenum cap);
static GLvoid 			(APIENTRY * dllDisableClientState)(GLenum array);
static GLvoid 			(APIENTRY * dllDrawArrays)(GLenum mode, GLint first, GLsizei count);
static GLvoid 			(APIENTRY * dllDrawBuffer)(GLenum mode);
static GLvoid 			(APIENTRY * dllDrawElements)(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
static GLvoid 			(APIENTRY * dllDrawPixels)(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
static GLvoid 			(APIENTRY * dllEdgeFlag)(GLboolean flag);
static GLvoid 			(APIENTRY * dllEdgeFlagPointer)(GLsizei stride, const GLvoid *pointer);
static GLvoid 			(APIENTRY * dllEdgeFlagv)(const GLboolean *flag);
static GLvoid 			(APIENTRY * dllEnable)(GLenum cap);
static GLvoid 			(APIENTRY * dllEnableClientState)(GLenum array);
static GLvoid 			(APIENTRY * dllEnd)(GLvoid);
static GLvoid 			(APIENTRY * dllEndList)(GLvoid);
static GLvoid 			(APIENTRY * dllEvalCoord1d)(GLdouble u);
static GLvoid 			(APIENTRY * dllEvalCoord1dv)(const GLdouble *u);
static GLvoid 			(APIENTRY * dllEvalCoord1f)(GLfloat u);
static GLvoid 			(APIENTRY * dllEvalCoord1fv)(const GLfloat *u);
static GLvoid 			(APIENTRY * dllEvalCoord2d)(GLdouble u, GLdouble v);
static GLvoid 			(APIENTRY * dllEvalCoord2dv)(const GLdouble *u);
static GLvoid 			(APIENTRY * dllEvalCoord2f)(GLfloat u, GLfloat v);
static GLvoid 			(APIENTRY * dllEvalCoord2fv)(const GLfloat *u);
static GLvoid 			(APIENTRY * dllEvalMesh1)(GLenum mode, GLint i1, GLint i2);
static GLvoid 			(APIENTRY * dllEvalMesh2)(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2);
static GLvoid 			(APIENTRY * dllEvalPoint1)(GLint i);
static GLvoid 			(APIENTRY * dllEvalPoint2)(GLint i, GLint j);
static GLvoid 			(APIENTRY * dllFeedbackBuffer)(GLsizei size, GLenum type, GLfloat *buffer);
static GLvoid 			(APIENTRY * dllFinish)(GLvoid);
static GLvoid 			(APIENTRY * dllFlush)(GLvoid);
static GLvoid 			(APIENTRY * dllFogf)(GLenum pname, GLfloat param);
static GLvoid 			(APIENTRY * dllFogfv)(GLenum pname, const GLfloat *params);
static GLvoid 			(APIENTRY * dllFogi)(GLenum pname, GLint param);
static GLvoid 			(APIENTRY * dllFogiv)(GLenum pname, const GLint *params);
static GLvoid 			(APIENTRY * dllFrontFace)(GLenum mode);
static GLvoid 			(APIENTRY * dllFrustum)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
static GLuint			(APIENTRY * dllGenLists)(GLsizei range);
static GLvoid 			(APIENTRY * dllGenTextures)(GLsizei n, GLuint *textures);
static GLvoid 			(APIENTRY * dllGetBooleanv)(GLenum pname, GLboolean *params);
static GLvoid 			(APIENTRY * dllGetClipPlane)(GLenum plane, GLdouble *equation);
static GLvoid 			(APIENTRY * dllGetDoublev)(GLenum pname, GLdouble *params);
static GLenum			(APIENTRY * dllGetError)(GLvoid);
static GLvoid 			(APIENTRY * dllGetFloatv)(GLenum pname, GLfloat *params);
static GLvoid 			(APIENTRY * dllGetIntegerv)(GLenum pname, GLint *params);
static GLvoid 			(APIENTRY * dllGetLightfv)(GLenum light, GLenum pname, GLfloat *params);
static GLvoid 			(APIENTRY * dllGetLightiv)(GLenum light, GLenum pname, GLint *params);
static GLvoid 			(APIENTRY * dllGetMapdv)(GLenum target, GLenum query, GLdouble *v);
static GLvoid 			(APIENTRY * dllGetMapfv)(GLenum target, GLenum query, GLfloat *v);
static GLvoid 			(APIENTRY * dllGetMapiv)(GLenum target, GLenum query, GLint *v);
static GLvoid 			(APIENTRY * dllGetMaterialfv)(GLenum face, GLenum pname, GLfloat *params);
static GLvoid 			(APIENTRY * dllGetMaterialiv)(GLenum face, GLenum pname, GLint *params);
static GLvoid 			(APIENTRY * dllGetPixelMapfv)(GLenum map, GLfloat *values);
static GLvoid 			(APIENTRY * dllGetPixelMapuiv)(GLenum map, GLuint *values);
static GLvoid 			(APIENTRY * dllGetPixelMapusv)(GLenum map, GLushort *values);
static GLvoid 			(APIENTRY * dllGetPointerv)(GLenum pname, GLvoid **params);
static GLvoid 			(APIENTRY * dllGetPolygonStipple)(GLubyte *mask);
static const GLubyte *	(APIENTRY * dllGetString)(GLenum name);
static GLvoid 			(APIENTRY * dllGetTexEnvfv)(GLenum target, GLenum pname, GLfloat *params);
static GLvoid 			(APIENTRY * dllGetTexEnviv)(GLenum target, GLenum pname, GLint *params);
static GLvoid 			(APIENTRY * dllGetTexGendv)(GLenum coord, GLenum pname, GLdouble *params);
static GLvoid 			(APIENTRY * dllGetTexGenfv)(GLenum coord, GLenum pname, GLfloat *params);
static GLvoid 			(APIENTRY * dllGetTexGeniv)(GLenum coord, GLenum pname, GLint *params);
static GLvoid 			(APIENTRY * dllGetTexImage)(GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels);
static GLvoid 			(APIENTRY * dllGetTexLevelParameterfv)(GLenum target, GLint level, GLenum pname, GLfloat *params);
static GLvoid 			(APIENTRY * dllGetTexLevelParameteriv)(GLenum target, GLint level, GLenum pname, GLint *params);
static GLvoid 			(APIENTRY * dllGetTexParameterfv)(GLenum target, GLenum pname, GLfloat *params);
static GLvoid 			(APIENTRY * dllGetTexParameteriv)(GLenum target, GLenum pname, GLint *params);
static GLvoid 			(APIENTRY * dllHint)(GLenum target, GLenum mode);
static GLvoid 			(APIENTRY * dllIndexMask)(GLuint mask);
static GLvoid 			(APIENTRY * dllIndexPointer)(GLenum type, GLsizei stride, const GLvoid *pointer);
static GLvoid 			(APIENTRY * dllIndexd)(GLdouble c);
static GLvoid 			(APIENTRY * dllIndexdv)(const GLdouble *c);
static GLvoid 			(APIENTRY * dllIndexf)(GLfloat c);
static GLvoid 			(APIENTRY * dllIndexfv)(const GLfloat *c);
static GLvoid 			(APIENTRY * dllIndexi)(GLint c);
static GLvoid 			(APIENTRY * dllIndexiv)(const GLint *c);
static GLvoid 			(APIENTRY * dllIndexs)(GLshort c);
static GLvoid 			(APIENTRY * dllIndexsv)(const GLshort *c);
static GLvoid 			(APIENTRY * dllIndexub)(GLubyte c);
static GLvoid 			(APIENTRY * dllIndexubv)(const GLubyte *c);
static GLvoid 			(APIENTRY * dllInitNames)(GLvoid);
static GLvoid 			(APIENTRY * dllInterleavedArrays)(GLenum format, GLsizei stride, const GLvoid *pointer);
static GLboolean		(APIENTRY * dllIsEnabled)(GLenum cap);
static GLboolean		(APIENTRY * dllIsList)(GLuint list);
static GLboolean		(APIENTRY * dllIsTexture)(GLuint texture);
static GLvoid 			(APIENTRY * dllLightModelf)(GLenum pname, GLfloat param);
static GLvoid 			(APIENTRY * dllLightModelfv)(GLenum pname, const GLfloat *params);
static GLvoid 			(APIENTRY * dllLightModeli)(GLenum pname, GLint param);
static GLvoid 			(APIENTRY * dllLightModeliv)(GLenum pname, const GLint *params);
static GLvoid 			(APIENTRY * dllLightf)(GLenum light, GLenum pname, GLfloat param);
static GLvoid 			(APIENTRY * dllLightfv)(GLenum light, GLenum pname, const GLfloat *params);
static GLvoid 			(APIENTRY * dllLighti)(GLenum light, GLenum pname, GLint param);
static GLvoid 			(APIENTRY * dllLightiv)(GLenum light, GLenum pname, const GLint *params);
static GLvoid 			(APIENTRY * dllLineStipple)(GLint factor, GLushort pattern);
static GLvoid 			(APIENTRY * dllLineWidth)(GLfloat width);
static GLvoid 			(APIENTRY * dllListBase)(GLuint base);
static GLvoid 			(APIENTRY * dllLoadIdentity)(GLvoid);
static GLvoid 			(APIENTRY * dllLoadMatrixd)(const GLdouble *m);
static GLvoid 			(APIENTRY * dllLoadMatrixf)(const GLfloat *m);
static GLvoid 			(APIENTRY * dllLoadName)(GLuint name);
static GLvoid 			(APIENTRY * dllLogicOp)(GLenum opcode);
static GLvoid 			(APIENTRY * dllMap1d)(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points);
static GLvoid 			(APIENTRY * dllMap1f)(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points);
static GLvoid 			(APIENTRY * dllMap2d)(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points);
static GLvoid 			(APIENTRY * dllMap2f)(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points);
static GLvoid 			(APIENTRY * dllMapGrid1d)(GLint un, GLdouble u1, GLdouble u2);
static GLvoid 			(APIENTRY * dllMapGrid1f)(GLint un, GLfloat u1, GLfloat u2);
static GLvoid 			(APIENTRY * dllMapGrid2d)(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2);
static GLvoid 			(APIENTRY * dllMapGrid2f)(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2);
static GLvoid 			(APIENTRY * dllMaterialf)(GLenum face, GLenum pname, GLfloat param);
static GLvoid 			(APIENTRY * dllMaterialfv)(GLenum face, GLenum pname, const GLfloat *params);
static GLvoid 			(APIENTRY * dllMateriali)(GLenum face, GLenum pname, GLint param);
static GLvoid 			(APIENTRY * dllMaterialiv)(GLenum face, GLenum pname, const GLint *params);
static GLvoid 			(APIENTRY * dllMatrixMode)(GLenum mode);
static GLvoid 			(APIENTRY * dllMultMatrixd)(const GLdouble *m);
static GLvoid 			(APIENTRY * dllMultMatrixf)(const GLfloat *m);
static GLvoid 			(APIENTRY * dllNewList)(GLuint list, GLenum mode);
static GLvoid 			(APIENTRY * dllNormal3b)(GLbyte nx, GLbyte ny, GLbyte nz);
static GLvoid 			(APIENTRY * dllNormal3bv)(const GLbyte *v);
static GLvoid 			(APIENTRY * dllNormal3d)(GLdouble nx, GLdouble ny, GLdouble nz);
static GLvoid 			(APIENTRY * dllNormal3dv)(const GLdouble *v);
static GLvoid 			(APIENTRY * dllNormal3f)(GLfloat nx, GLfloat ny, GLfloat nz);
static GLvoid 			(APIENTRY * dllNormal3fv)(const GLfloat *v);
static GLvoid 			(APIENTRY * dllNormal3i)(GLint nx, GLint ny, GLint nz);
static GLvoid 			(APIENTRY * dllNormal3iv)(const GLint *v);
static GLvoid 			(APIENTRY * dllNormal3s)(GLshort nx, GLshort ny, GLshort nz);
static GLvoid 			(APIENTRY * dllNormal3sv)(const GLshort *v);
static GLvoid 			(APIENTRY * dllNormalPointer)(GLenum type, GLsizei stride, const GLvoid *pointer);
static GLvoid 			(APIENTRY * dllOrtho)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
static GLvoid 			(APIENTRY * dllPassThrough)(GLfloat token);
static GLvoid 			(APIENTRY * dllPixelMapfv)(GLenum map, GLsizei mapsize, const GLfloat *values);
static GLvoid 			(APIENTRY * dllPixelMapuiv)(GLenum map, GLsizei mapsize, const GLuint *values);
static GLvoid 			(APIENTRY * dllPixelMapusv)(GLenum map, GLsizei mapsize, const GLushort *values);
static GLvoid 			(APIENTRY * dllPixelStoref)(GLenum pname, GLfloat param);
static GLvoid 			(APIENTRY * dllPixelStorei)(GLenum pname, GLint param);
static GLvoid 			(APIENTRY * dllPixelTransferf)(GLenum pname, GLfloat param);
static GLvoid 			(APIENTRY * dllPixelTransferi)(GLenum pname, GLint param);
static GLvoid 			(APIENTRY * dllPixelZoom)(GLfloat xfactor, GLfloat yfactor);
static GLvoid 			(APIENTRY * dllPointSize)(GLfloat size);
static GLvoid 			(APIENTRY * dllPolygonMode)(GLenum face, GLenum mode);
static GLvoid 			(APIENTRY * dllPolygonOffset)(GLfloat factor, GLfloat units);
static GLvoid 			(APIENTRY * dllPolygonStipple)(const GLubyte *mask);
static GLvoid 			(APIENTRY * dllPopAttrib)(GLvoid);
static GLvoid 			(APIENTRY * dllPopClientAttrib)(GLvoid);
static GLvoid 			(APIENTRY * dllPopMatrix)(GLvoid);
static GLvoid 			(APIENTRY * dllPopName)(GLvoid);
static GLvoid 			(APIENTRY * dllPrioritizeTextures)(GLsizei n, const GLuint *textures, const GLclampf *priorities);
static GLvoid 			(APIENTRY * dllPushAttrib)(GLbitfield mask);
static GLvoid 			(APIENTRY * dllPushClientAttrib)(GLbitfield mask);
static GLvoid 			(APIENTRY * dllPushMatrix)(GLvoid);
static GLvoid 			(APIENTRY * dllPushName)(GLuint name);
static GLvoid 			(APIENTRY * dllRasterPos2d)(GLdouble x, GLdouble y);
static GLvoid 			(APIENTRY * dllRasterPos2dv)(const GLdouble *v);
static GLvoid 			(APIENTRY * dllRasterPos2f)(GLfloat x, GLfloat y);
static GLvoid 			(APIENTRY * dllRasterPos2fv)(const GLfloat *v);
static GLvoid 			(APIENTRY * dllRasterPos2i)(GLint x, GLint y);
static GLvoid 			(APIENTRY * dllRasterPos2iv)(const GLint *v);
static GLvoid 			(APIENTRY * dllRasterPos2s)(GLshort x, GLshort y);
static GLvoid 			(APIENTRY * dllRasterPos2sv)(const GLshort *v);
static GLvoid 			(APIENTRY * dllRasterPos3d)(GLdouble x, GLdouble y, GLdouble z);
static GLvoid 			(APIENTRY * dllRasterPos3dv)(const GLdouble *v);
static GLvoid 			(APIENTRY * dllRasterPos3f)(GLfloat x, GLfloat y, GLfloat z);
static GLvoid 			(APIENTRY * dllRasterPos3fv)(const GLfloat *v);
static GLvoid 			(APIENTRY * dllRasterPos3i)(GLint x, GLint y, GLint z);
static GLvoid 			(APIENTRY * dllRasterPos3iv)(const GLint *v);
static GLvoid 			(APIENTRY * dllRasterPos3s)(GLshort x, GLshort y, GLshort z);
static GLvoid 			(APIENTRY * dllRasterPos3sv)(const GLshort *v);
static GLvoid 			(APIENTRY * dllRasterPos4d)(GLdouble x, GLdouble y, GLdouble z, GLdouble w);
static GLvoid 			(APIENTRY * dllRasterPos4dv)(const GLdouble *v);
static GLvoid 			(APIENTRY * dllRasterPos4f)(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
static GLvoid 			(APIENTRY * dllRasterPos4fv)(const GLfloat *v);
static GLvoid 			(APIENTRY * dllRasterPos4i)(GLint x, GLint y, GLint z, GLint w);
static GLvoid 			(APIENTRY * dllRasterPos4iv)(const GLint *v);
static GLvoid 			(APIENTRY * dllRasterPos4s)(GLshort x, GLshort y, GLshort z, GLshort w);
static GLvoid 			(APIENTRY * dllRasterPos4sv)(const GLshort *v);
static GLvoid 			(APIENTRY * dllReadBuffer)(GLenum mode);
static GLvoid 			(APIENTRY * dllReadPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);
static GLvoid 			(APIENTRY * dllRectd)(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2);
static GLvoid 			(APIENTRY * dllRectdv)(const GLdouble *v1, const GLdouble *v2);
static GLvoid 			(APIENTRY * dllRectf)(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2);
static GLvoid 			(APIENTRY * dllRectfv)(const GLfloat *v1, const GLfloat *v2);
static GLvoid 			(APIENTRY * dllRecti)(GLint x1, GLint y1, GLint x2, GLint y2);
static GLvoid 			(APIENTRY * dllRectiv)(const GLint *v1, const GLint *v2);
static GLvoid 			(APIENTRY * dllRects)(GLshort x1, GLshort y1, GLshort x2, GLshort y2);
static GLvoid 			(APIENTRY * dllRectsv)(const GLshort *v1, const GLshort *v2);
static GLint			(APIENTRY * dllRenderMode)(GLenum mode);
static GLvoid 			(APIENTRY * dllRotated)(GLdouble angle, GLdouble x, GLdouble y, GLdouble z);
static GLvoid 			(APIENTRY * dllRotatef)(GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
static GLvoid 			(APIENTRY * dllScaled)(GLdouble x, GLdouble y, GLdouble z);
static GLvoid 			(APIENTRY * dllScalef)(GLfloat x, GLfloat y, GLfloat z);
static GLvoid 			(APIENTRY * dllScissor)(GLint x, GLint y, GLsizei width, GLsizei height);
static GLvoid 			(APIENTRY * dllSelectBuffer)(GLsizei size, GLuint *buffer);
static GLvoid 			(APIENTRY * dllShadeModel)(GLenum mode);
static GLvoid 			(APIENTRY * dllStencilFunc)(GLenum func, GLint ref, GLuint mask);
static GLvoid 			(APIENTRY * dllStencilMask)(GLuint mask);
static GLvoid 			(APIENTRY * dllStencilOp)(GLenum fail, GLenum zfail, GLenum zpass);
static GLvoid 			(APIENTRY * dllTexCoord1d)(GLdouble s);
static GLvoid 			(APIENTRY * dllTexCoord1dv)(const GLdouble *v);
static GLvoid 			(APIENTRY * dllTexCoord1f)(GLfloat s);
static GLvoid 			(APIENTRY * dllTexCoord1fv)(const GLfloat *v);
static GLvoid 			(APIENTRY * dllTexCoord1i)(GLint s);
static GLvoid 			(APIENTRY * dllTexCoord1iv)(const GLint *v);
static GLvoid 			(APIENTRY * dllTexCoord1s)(GLshort s);
static GLvoid 			(APIENTRY * dllTexCoord1sv)(const GLshort *v);
static GLvoid 			(APIENTRY * dllTexCoord2d)(GLdouble s, GLdouble t);
static GLvoid 			(APIENTRY * dllTexCoord2dv)(const GLdouble *v);
static GLvoid 			(APIENTRY * dllTexCoord2f)(GLfloat s, GLfloat t);
static GLvoid 			(APIENTRY * dllTexCoord2fv)(const GLfloat *v);
static GLvoid 			(APIENTRY * dllTexCoord2i)(GLint s, GLint t);
static GLvoid 			(APIENTRY * dllTexCoord2iv)(const GLint *v);
static GLvoid 			(APIENTRY * dllTexCoord2s)(GLshort s, GLshort t);
static GLvoid 			(APIENTRY * dllTexCoord2sv)(const GLshort *v);
static GLvoid 			(APIENTRY * dllTexCoord3d)(GLdouble s, GLdouble t, GLdouble r);
static GLvoid 			(APIENTRY * dllTexCoord3dv)(const GLdouble *v);
static GLvoid 			(APIENTRY * dllTexCoord3f)(GLfloat s, GLfloat t, GLfloat r);
static GLvoid 			(APIENTRY * dllTexCoord3fv)(const GLfloat *v);
static GLvoid 			(APIENTRY * dllTexCoord3i)(GLint s, GLint t, GLint r);
static GLvoid 			(APIENTRY * dllTexCoord3iv)(const GLint *v);
static GLvoid 			(APIENTRY * dllTexCoord3s)(GLshort s, GLshort t, GLshort r);
static GLvoid 			(APIENTRY * dllTexCoord3sv)(const GLshort *v);
static GLvoid 			(APIENTRY * dllTexCoord4d)(GLdouble s, GLdouble t, GLdouble r, GLdouble q);
static GLvoid 			(APIENTRY * dllTexCoord4dv)(const GLdouble *v);
static GLvoid 			(APIENTRY * dllTexCoord4f)(GLfloat s, GLfloat t, GLfloat r, GLfloat q);
static GLvoid 			(APIENTRY * dllTexCoord4fv)(const GLfloat *v);
static GLvoid 			(APIENTRY * dllTexCoord4i)(GLint s, GLint t, GLint r, GLint q);
static GLvoid 			(APIENTRY * dllTexCoord4iv)(const GLint *v);
static GLvoid 			(APIENTRY * dllTexCoord4s)(GLshort s, GLshort t, GLshort r, GLshort q);
static GLvoid 			(APIENTRY * dllTexCoord4sv)(const GLshort *v);
static GLvoid 			(APIENTRY * dllTexCoordPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
static GLvoid 			(APIENTRY * dllTexEnvf)(GLenum target, GLenum pname, GLfloat param);
static GLvoid 			(APIENTRY * dllTexEnvfv)(GLenum target, GLenum pname, const GLfloat *params);
static GLvoid 			(APIENTRY * dllTexEnvi)(GLenum target, GLenum pname, GLint param);
static GLvoid 			(APIENTRY * dllTexEnviv)(GLenum target, GLenum pname, const GLint *params);
static GLvoid 			(APIENTRY * dllTexGend)(GLenum coord, GLenum pname, GLdouble param);
static GLvoid 			(APIENTRY * dllTexGendv)(GLenum coord, GLenum pname, const GLdouble *params);
static GLvoid 			(APIENTRY * dllTexGenf)(GLenum coord, GLenum pname, GLfloat param);
static GLvoid 			(APIENTRY * dllTexGenfv)(GLenum coord, GLenum pname, const GLfloat *params);
static GLvoid 			(APIENTRY * dllTexGeni)(GLenum coord, GLenum pname, GLint param);
static GLvoid 			(APIENTRY * dllTexGeniv)(GLenum coord, GLenum pname, const GLint *params);
static GLvoid 			(APIENTRY * dllTexImage1D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
static GLvoid 			(APIENTRY * dllTexImage2D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
static GLvoid 			(APIENTRY * dllTexParameterf)(GLenum target, GLenum pname, GLfloat param);
static GLvoid 			(APIENTRY * dllTexParameterfv)(GLenum target, GLenum pname, const GLfloat *params);
static GLvoid 			(APIENTRY * dllTexParameteri)(GLenum target, GLenum pname, GLint param);
static GLvoid 			(APIENTRY * dllTexParameteriv)(GLenum target, GLenum pname, const GLint *params);
static GLvoid 			(APIENTRY * dllTexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels);
static GLvoid 			(APIENTRY * dllTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
static GLvoid 			(APIENTRY * dllTranslated)(GLdouble x, GLdouble y, GLdouble z);
static GLvoid 			(APIENTRY * dllTranslatef)(GLfloat x, GLfloat y, GLfloat z);
static GLvoid 			(APIENTRY * dllVertex2d)(GLdouble x, GLdouble y);
static GLvoid 			(APIENTRY * dllVertex2dv)(const GLdouble *v);
static GLvoid 			(APIENTRY * dllVertex2f)(GLfloat x, GLfloat y);
static GLvoid 			(APIENTRY * dllVertex2fv)(const GLfloat *v);
static GLvoid 			(APIENTRY * dllVertex2i)(GLint x, GLint y);
static GLvoid 			(APIENTRY * dllVertex2iv)(const GLint *v);
static GLvoid 			(APIENTRY * dllVertex2s)(GLshort x, GLshort y);
static GLvoid 			(APIENTRY * dllVertex2sv)(const GLshort *v);
static GLvoid 			(APIENTRY * dllVertex3d)(GLdouble x, GLdouble y, GLdouble z);
static GLvoid 			(APIENTRY * dllVertex3dv)(const GLdouble *v);
static GLvoid 			(APIENTRY * dllVertex3f)(GLfloat x, GLfloat y, GLfloat z);
static GLvoid 			(APIENTRY * dllVertex3fv)(const GLfloat *v);
static GLvoid 			(APIENTRY * dllVertex3i)(GLint x, GLint y, GLint z);
static GLvoid 			(APIENTRY * dllVertex3iv)(const GLint *v);
static GLvoid 			(APIENTRY * dllVertex3s)(GLshort x, GLshort y, GLshort z);
static GLvoid 			(APIENTRY * dllVertex3sv)(const GLshort *v);
static GLvoid 			(APIENTRY * dllVertex4d)(GLdouble x, GLdouble y, GLdouble z, GLdouble w);
static GLvoid 			(APIENTRY * dllVertex4dv)(const GLdouble *v);
static GLvoid 			(APIENTRY * dllVertex4f)(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
static GLvoid 			(APIENTRY * dllVertex4fv)(const GLfloat *v);
static GLvoid 			(APIENTRY * dllVertex4i)(GLint x, GLint y, GLint z, GLint w);
static GLvoid 			(APIENTRY * dllVertex4iv)(const GLint *v);
static GLvoid 			(APIENTRY * dllVertex4s)(GLshort x, GLshort y, GLshort z, GLshort w);
static GLvoid 			(APIENTRY * dllVertex4sv)(const GLshort *v);
static GLvoid 			(APIENTRY * dllVertexPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
static GLvoid 			(APIENTRY * dllViewport)(GLint x, GLint y, GLsizei width, GLsizei height);

static GLvoid			(APIENTRY * dllActiveTexture)(GLenum texture);

static GLvoid			(APIENTRY * dllGenBuffers)(GLsizei n, GLuint *buffers);
static GLvoid			(APIENTRY * dllDeleteBuffers)(GLsizei n, const GLuint *buffers);
static GLvoid			(APIENTRY * dllBindBuffer)(GLenum target, GLuint buffer);
static GLvoid			(APIENTRY * dllBufferData)(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage);
static GLvoid			(APIENTRY * dllBufferSubData)(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data);
static GLvoid *			(APIENTRY * dllMapBuffer)(GLenum target, GLenum access);
static GLboolean		(APIENTRY * dllUnmapBuffer)(GLenum target);

static GLuint			(APIENTRY * dllCreateShader)(GLenum type);
static GLuint			(APIENTRY * dllCreateProgram)(GLvoid);
static GLvoid			(APIENTRY * dllDeleteShader)(GLuint shader);
static GLvoid			(APIENTRY * dllDeleteProgram)(GLuint program);
static GLvoid			(APIENTRY * dllGetShaderiv)(GLuint shader, GLenum pname, GLint *params);
static GLvoid			(APIENTRY * dllGetProgramiv)(GLuint program, GLenum pname, GLint *params);
static GLvoid			(APIENTRY * dllGetShaderInfoLog)(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
static GLvoid			(APIENTRY * dllGetProgramInfoLog)(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
static GLvoid			(APIENTRY * dllShaderSource)(GLuint shader, GLsizei count, const GLchar **string, const GLint *length);
static GLvoid			(APIENTRY * dllCompileShader)(GLuint shader);
static GLvoid			(APIENTRY * dllAttachShader)(GLuint program, GLuint shader);
static GLvoid			(APIENTRY * dllDetachShader)(GLuint program, GLuint shader);
static GLvoid			(APIENTRY * dllLinkProgram)(GLuint program);
static GLvoid			(APIENTRY * dllUseProgram)(GLuint program);
static GLvoid			(APIENTRY * dllVertexAttribPointer)(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer);
static GLvoid			(APIENTRY * dllEnableVertexAttribArray)(GLuint index);
static GLvoid			(APIENTRY * dllDisableVertexAttribArray)(GLuint index);
static GLvoid			(APIENTRY * dllBindAttribLocation)(GLuint program, GLuint index, const GLchar *name);
static GLint			(APIENTRY * dllGetAttribLocation)(GLuint program, const GLchar *name);
static GLvoid			(APIENTRY * dllGetActiveUniform)(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
static GLint			(APIENTRY * dllGetUniformLocation)(GLuint program, const GLchar *name);
static GLvoid			(APIENTRY * dllUniform1f)(GLint location, GLfloat v0);
static GLvoid			(APIENTRY * dllUniform2f)(GLint location, GLfloat v0, GLfloat v1);
static GLvoid			(APIENTRY * dllUniform3f)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
static GLvoid			(APIENTRY * dllUniform4f)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
static GLvoid			(APIENTRY * dllUniform1i)(GLint location, GLint v0);
static GLvoid			(APIENTRY * dllUniform2i)(GLint location, GLint v0, GLint v1);
static GLvoid			(APIENTRY * dllUniform3i)(GLint location, GLint v0, GLint v1, GLint v2);
static GLvoid			(APIENTRY * dllUniform4i)(GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
static GLvoid			(APIENTRY * dllUniform1fv)(GLint location, GLsizei count, const GLfloat *value);
static GLvoid			(APIENTRY * dllUniform2fv)(GLint location, GLsizei count, const GLfloat *value);
static GLvoid			(APIENTRY * dllUniform3fv)(GLint location, GLsizei count, const GLfloat *value);
static GLvoid			(APIENTRY * dllUniform4fv)(GLint location, GLsizei count, const GLfloat *value);
static GLvoid			(APIENTRY * dllUniform1iv)(GLint location, GLsizei count, const GLint *value);
static GLvoid			(APIENTRY * dllUniform2iv)(GLint location, GLsizei count, const GLint *value);
static GLvoid			(APIENTRY * dllUniform3iv)(GLint location, GLsizei count, const GLint *value);
static GLvoid			(APIENTRY * dllUniform4iv)(GLint location, GLsizei count, const GLint *value);
static GLvoid			(APIENTRY * dllUniformMatrix2fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
static GLvoid			(APIENTRY * dllUniformMatrix3fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
static GLvoid			(APIENTRY * dllUniformMatrix4fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);

static GLvoid			(APIENTRY * dllStencilFuncSeparate)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask);
static GLvoid			(APIENTRY * dllStencilOpSeparate)(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
static GLvoid			(APIENTRY * dllStencilMaskSeparate)(GLenum face, GLuint mask);

static GLvoid			(APIENTRY * dllDepthBoundsEXT)(GLclampd zmin, GLclampd zmax);

static BOOL				(WINAPI   * dllSwapIntervalEXT)(int interval);


// ============================================================================


static GLvoid APIENTRY logAccum (GLenum op, GLfloat value){

	fprintf(qglState.logFile, "glAccum( 0x%X, %g )\n", op, value);
	dllAccum(op, value);
}

static GLvoid APIENTRY logAlphaFunc (GLenum func, GLclampf ref){

	const char	*f;

	switch (func){
	case GL_NEVER:		f = "GL_NEVER";					break;
	case GL_LESS:		f = "GL_LESS";					break;
	case GL_EQUAL:		f = "GL_EQUAL";					break;
	case GL_LEQUAL:		f = "GL_LEQUAL";				break;
	case GL_GREATER:	f = "GL_GREATER";				break;
	case GL_NOTEQUAL:	f = "GL_NOTEQUAL";				break;
	case GL_GEQUAL:		f = "GL_GEQUAL";				break;
	case GL_ALWAYS:		f = "GL_ALWAYS";				break;
	default:			f = Str_VarArgs("0x%X", func);	break;
	}

	fprintf(qglState.logFile, "glAlphaFunc( %s, %g )\n", f, ref);
	dllAlphaFunc(func, ref);
}

static GLboolean APIENTRY logAreTexturesResident (GLsizei n, const GLuint *textures, GLboolean *residences){

	fprintf(qglState.logFile, "glAreTexturesResident( %i, %p, %p )\n", n, textures, residences);
	return dllAreTexturesResident(n, textures, residences);
}

static GLvoid APIENTRY logArrayElement (GLint i){

	fprintf(qglState.logFile, "glArrayElement( %i )\n", i);
	dllArrayElement(i);
}

static GLvoid APIENTRY logBegin (GLenum mode){

	const char	*m;

	switch (mode){
	case GL_POINTS:			m = "GL_POINTS";				break;
	case GL_LINES:			m = "GL_LINES";					break;
	case GL_LINE_STRIP:		m = "GL_LINE_STRIP";			break;
	case GL_LINE_LOOP:		m = "GL_LINE_LOOP";				break;
	case GL_TRIANGLES:		m = "GL_TRIANGLES";				break;
	case GL_TRIANGLE_STRIP: m = "GL_TRIANGLE_STRIP";		break;
	case GL_TRIANGLE_FAN:	m = "GL_TRIANGLE_FAN";			break;
	case GL_QUADS:			m = "GL_QUADS";					break;
	case GL_QUAD_STRIP:		m = "GL_QUAD_STRIP";			break;
	case GL_POLYGON:		m = "GL_POLYGON";				break;
	default:				m = Str_VarArgs("0x%X", mode);	break;
	}

	fprintf(qglState.logFile, "glBegin( %s )\n", m, mode);
	dllBegin(mode);
}

static GLvoid APIENTRY logBindTexture (GLenum target, GLuint texture){

	const char	*t;

	switch (target){
	case GL_TEXTURE_1D:			t = "GL_TEXTURE_1D";				break;
	case GL_TEXTURE_2D:			t = "GL_TEXTURE_2D";				break;
	case GL_TEXTURE_3D:			t = "GL_TEXTURE_3D";				break;
	case GL_TEXTURE_CUBE_MAP:	t = "GL_TEXTURE_CUBE_MAP";			break;
	default:					t = Str_VarArgs("0x%X", target);	break;
	}

	fprintf(qglState.logFile, "glBindTexture( %s, %u )\n", t, texture);
	dllBindTexture(target, texture);
}

static GLvoid APIENTRY logBitmap (GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap){

	fprintf(qglState.logFile, "glBitmap( %i, %i, %g, %g, %g, %g, %p )\n", width, height, xorig, yorig, xmove, ymove, bitmap);
	dllBitmap(width, height, xorig, yorig, xmove, ymove, bitmap);
}

static GLvoid APIENTRY logBlendFunc (GLenum sfactor, GLenum dfactor){

	const char	*s, *d;

	switch (sfactor){
	case GL_ZERO:					s = "GL_ZERO";						break;
	case GL_ONE:					s = "GL_ONE";						break;
	case GL_SRC_COLOR:				s = "GL_SRC_COLOR";					break;
	case GL_ONE_MINUS_SRC_COLOR:	s = "GL_ONE_MINUS_SRC_COLOR";		break;
	case GL_DST_COLOR:				s = "GL_DST_COLOR";					break;
	case GL_ONE_MINUS_DST_COLOR:	s = "GL_ONE_MINUS_DST_COLOR";		break;
	case GL_SRC_ALPHA:				s = "GL_SRC_ALPHA";					break;
	case GL_ONE_MINUS_SRC_ALPHA:	s = "GL_ONE_MINUS_SRC_ALPHA";		break;
	case GL_DST_ALPHA:				s = "GL_DST_ALPHA";					break;
	case GL_ONE_MINUS_DST_ALPHA:	s = "GL_ONE_MINUS_DST_ALPHA";		break;
	case GL_SRC_ALPHA_SATURATE:		s = "GL_SRC_ALPHA_SATURATE";		break;
	default:						s = Str_VarArgs("0x%X", sfactor);	break;
	}

	switch (dfactor){
	case GL_ZERO:					d = "GL_ZERO";						break;
	case GL_ONE:					d = "GL_ONE";						break;
	case GL_SRC_COLOR:				d = "GL_SRC_COLOR";					break;
	case GL_ONE_MINUS_SRC_COLOR:	d = "GL_ONE_MINUS_SRC_COLOR";		break;
	case GL_DST_COLOR:				d = "GL_DST_COLOR";					break;
	case GL_ONE_MINUS_DST_COLOR:	d = "GL_ONE_MINUS_DST_COLOR";		break;
	case GL_SRC_ALPHA:				d = "GL_SRC_ALPHA";					break;
	case GL_ONE_MINUS_SRC_ALPHA:	d = "GL_ONE_MINUS_SRC_ALPHA";		break;
	case GL_DST_ALPHA:				d = "GL_DST_ALPHA";					break;
	case GL_ONE_MINUS_DST_ALPHA:	d = "GL_ONE_MINUS_DST_ALPHA";		break;
	default:						d = Str_VarArgs("0x%X", dfactor);	break;
	}

	fprintf(qglState.logFile, "glBlendFunc( %s, %s )\n", s, d);
	dllBlendFunc(sfactor, dfactor);
}

static GLvoid APIENTRY logCallList (GLuint list){

	fprintf(qglState.logFile, "glCallList( %u )\n", list);
	dllCallList(list);
}

static GLvoid APIENTRY logCallLists (GLsizei n, GLenum type, const GLvoid *lists){

	fprintf(qglState.logFile, "glCallLists( %i, 0x%X, %p )\n", n, type, lists);
	dllCallLists(n, type, lists);
}

static GLvoid APIENTRY logClear (GLbitfield mask){

	fprintf(qglState.logFile, "glClear( ");

	if (mask & GL_ACCUM_BUFFER_BIT)
		fprintf(qglState.logFile, "GL_ACCUM_BUFFER_BIT ");
	if (mask & GL_COLOR_BUFFER_BIT)
		fprintf(qglState.logFile, "GL_COLOR_BUFFER_BIT ");
	if (mask & GL_DEPTH_BUFFER_BIT)
		fprintf(qglState.logFile, "GL_DEPTH_BUFFER_BIT ");
	if (mask & GL_STENCIL_BUFFER_BIT)
		fprintf(qglState.logFile, "GL_STENCIL_BUFFER_BIT ");

	fprintf(qglState.logFile, ")\n");
	dllClear(mask);
}

static GLvoid APIENTRY logClearAccum (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha){

	fprintf(qglState.logFile, "glClearAccum( %g, %g, %g, %g )\n", red, green, blue, alpha);
	dllClearAccum(red, green, blue, alpha);
}

static GLvoid APIENTRY logClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha){

	fprintf(qglState.logFile, "glClearColor( %g, %g, %g, %g )\n", red, green, blue, alpha);
	dllClearColor(red, green, blue, alpha);
}

static GLvoid APIENTRY logClearDepth (GLclampd depth){

	fprintf(qglState.logFile, "glClearDepth( %g )\n", depth);
	dllClearDepth(depth);
}

static GLvoid APIENTRY logClearIndex (GLfloat c){

	fprintf(qglState.logFile, "glClearIndex( %g )\n", c);
	dllClearIndex(c);
}

static GLvoid APIENTRY logClearStencil (GLint s){

	fprintf(qglState.logFile, "glClearStencil( %i )\n", s);
	dllClearStencil(s);
}

static GLvoid APIENTRY logClipPlane (GLenum plane, const GLdouble *equation){

	const char	*p;

	if (plane >= GL_CLIP_PLANE0 && plane <= GL_CLIP_PLANE5)
		p = Str_VarArgs("GL_CLIP_PLANE%i", GL_CLIP_PLANE5 - plane);

	fprintf(qglState.logFile, "glClipPlane( %s, %p )\n", p, equation);
	dllClipPlane(plane, equation);
}

static GLvoid APIENTRY logColor3b (GLbyte red, GLbyte green, GLbyte blue){

	fprintf(qglState.logFile, "glColor3b( %i, %i, %i )\n", red, green, blue);
	dllColor3b(red, green, blue);
}

static GLvoid APIENTRY logColor3bv (const GLbyte *v){

	fprintf(qglState.logFile, "glColor3bv( %p )\n", v);
	dllColor3bv(v);
}

static GLvoid APIENTRY logColor3d (GLdouble red, GLdouble green, GLdouble blue){

	fprintf(qglState.logFile, "glColor3d( %g, %g, %g )\n", red, green, blue);
	dllColor3d(red, green, blue);
}

static GLvoid APIENTRY logColor3dv (const GLdouble *v){

	fprintf(qglState.logFile, "glColor3dv( %p )\n", v);
	dllColor3dv(v);
}

static GLvoid APIENTRY logColor3f (GLfloat red, GLfloat green, GLfloat blue){

	fprintf(qglState.logFile, "glColor3f( %g, %g, %g )\n", red, green, blue);
	dllColor3f(red, green, blue);
}

static GLvoid APIENTRY logColor3fv (const GLfloat *v){

	fprintf(qglState.logFile, "glColor3fv( %p )\n", v);
	dllColor3fv(v);
}

static GLvoid APIENTRY logColor3i (GLint red, GLint green, GLint blue){

	fprintf(qglState.logFile, "glColor3i( %i, %i, %i )\n", red, green, blue);
	dllColor3i(red, green, blue);
}

static GLvoid APIENTRY logColor3iv (const GLint *v){

	fprintf(qglState.logFile, "glColor3iv( %p )\n", v);
	dllColor3iv(v);
}

static GLvoid APIENTRY logColor3s (GLshort red, GLshort green, GLshort blue){

	fprintf(qglState.logFile, "glColor3s( %i, %i, %i )\n", red, green, blue);
	dllColor3s(red, green, blue);
}

static GLvoid APIENTRY logColor3sv (const GLshort *v){

	fprintf(qglState.logFile, "glColor3sv( %p )\n", v);
	dllColor3sv(v);
}

static GLvoid APIENTRY logColor3ub (GLubyte red, GLubyte green, GLubyte blue){

	fprintf(qglState.logFile, "glColor3ub( %u, %u, %u )\n", red, green, blue);
	dllColor3ub(red, green, blue);
}

static GLvoid APIENTRY logColor3ubv (const GLubyte *v){

	fprintf(qglState.logFile, "glColor3ubv( %p )\n", v);
	dllColor3ubv(v);
}

static GLvoid APIENTRY logColor3ui (GLuint red, GLuint green, GLuint blue){

	fprintf(qglState.logFile, "glColor3ui( %u, %u, %u )\n", red, green, blue);
	dllColor3ui(red, green, blue);
}

static GLvoid APIENTRY logColor3uiv (const GLuint *v){

	fprintf(qglState.logFile, "glColor3uiv( %p )\n", v);
	dllColor3uiv(v);
}

static GLvoid APIENTRY logColor3us (GLushort red, GLushort green, GLushort blue){

	fprintf(qglState.logFile, "glColor3us( %u, %u, %u )\n", red, green, blue);
	dllColor3us(red, green, blue);
}

static GLvoid APIENTRY logColor3usv (const GLushort *v){

	fprintf(qglState.logFile, "glColor3usv( %p )\n", v);
	dllColor3usv(v);
}

static GLvoid APIENTRY logColor4b (GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha){

	fprintf(qglState.logFile, "glColor4b( %i, %i, %i, %i )\n", red, green, blue, alpha);
	dllColor4b(red, green, blue, alpha);
}

static GLvoid APIENTRY logColor4bv (const GLbyte *v){

	fprintf(qglState.logFile, "glColor4bv( %p )\n", v);
	dllColor4bv(v);
}

static GLvoid APIENTRY logColor4d (GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha){

	fprintf(qglState.logFile, "glColor4d( %g, %g, %g, %g )\n", red, green, blue, alpha);
	dllColor4d(red, green, blue, alpha);
}

static GLvoid APIENTRY logColor4dv (const GLdouble *v){

	fprintf(qglState.logFile, "glColor4dv( %p )\n", v);
	dllColor4dv(v);
}

static GLvoid APIENTRY logColor4f (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha){

	fprintf(qglState.logFile, "glColor4f( %g, %g, %g, %g )\n", red, green, blue, alpha);
	dllColor4f(red, green, blue, alpha);
}

static GLvoid APIENTRY logColor4fv (const GLfloat *v){

	fprintf(qglState.logFile, "glColor4fv( %p )\n", v);
	dllColor4fv(v);
}

static GLvoid APIENTRY logColor4i (GLint red, GLint green, GLint blue, GLint alpha){

	fprintf(qglState.logFile, "glColor4i( %i, %i, %i, %i )\n", red, green, blue, alpha);
	dllColor4i(red, green, blue, alpha);
}

static GLvoid APIENTRY logColor4iv (const GLint *v){

	fprintf(qglState.logFile, "glColor4iv( %p )\n", v);
	dllColor4iv(v);
}

static GLvoid APIENTRY logColor4s (GLshort red, GLshort green, GLshort blue, GLshort alpha){

	fprintf(qglState.logFile, "glColor4s( %i, %i, %i, %i )\n", red, green, blue, alpha);
	dllColor4s(red, green, blue, alpha);
}

static GLvoid APIENTRY logColor4sv (const GLshort *v){

	fprintf(qglState.logFile, "glColor4sv( %p )\n", v);
	dllColor4sv(v);
}

static GLvoid APIENTRY logColor4ub (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha){

	fprintf(qglState.logFile, "glColor4ub( %u, %u, %u, %u )\n", red, green, blue, alpha);
	dllColor4b(red, green, blue, alpha);
}

static GLvoid APIENTRY logColor4ubv (const GLubyte *v){

	fprintf(qglState.logFile, "glColor4ubv( %p )\n", v);
	dllColor4ubv(v);
}

static GLvoid APIENTRY logColor4ui (GLuint red, GLuint green, GLuint blue, GLuint alpha){

	fprintf(qglState.logFile, "glColor4ui( %u, %u, %u, %u )\n", red, green, blue, alpha);
	dllColor4ui(red, green, blue, alpha);
}

static GLvoid APIENTRY logColor4uiv (const GLuint *v){

	fprintf(qglState.logFile, "glColor4uiv( %p )\n", v);
	dllColor4uiv(v);
}

static GLvoid APIENTRY logColor4us (GLushort red, GLushort green, GLushort blue, GLushort alpha){

	fprintf(qglState.logFile, "glColor4us( %u, %u, %u, %u )\n", red, green, blue, alpha);
	dllColor4us(red, green, blue, alpha);
}

static GLvoid APIENTRY logColor4usv (const GLushort *v){

	fprintf(qglState.logFile, "glColor4usv( %p )\n", v);
	dllColor4usv(v);
}

static GLvoid APIENTRY logColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha){

	const char	*r, *g, *b, *a;

	switch (red){
	case GL_FALSE:		r = "GL_FALSE";					break;
	case GL_TRUE:		r = "GL_TRUE";					break;
	default:			r = Str_VarArgs("0x%X", red);	break;
	}

	switch (green){
	case GL_FALSE:		g = "GL_FALSE";					break;
	case GL_TRUE:		g = "GL_TRUE";					break;
	default:			g = Str_VarArgs("0x%X", green);	break;
	}

	switch (blue){
	case GL_FALSE:		b = "GL_FALSE";					break;
	case GL_TRUE:		b = "GL_TRUE";					break;
	default:			b = Str_VarArgs("0x%X", blue);	break;
	}

	switch (alpha){
	case GL_FALSE:		a = "GL_FALSE";					break;
	case GL_TRUE:		a = "GL_TRUE";					break;
	default:			a = Str_VarArgs("0x%X", alpha);	break;
	}

	fprintf(qglState.logFile, "glColorMask( %s, %s, %s, %s )\n", r, g, b, a);
	dllColorMask(red, green, blue, alpha);
}

static GLvoid APIENTRY logColorMaterial (GLenum face, GLenum mode){

	fprintf(qglState.logFile, "glColorMaterial( 0x%X, 0x%X )\n", face, mode);
	dllColorMaterial(face, mode);
}

static GLvoid APIENTRY logColorPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer){

	const char	*t;

	switch (type){
	case GL_BYTE:			t = "GL_BYTE";					break;
	case GL_UNSIGNED_BYTE:	t = "GL_UNSIGNED_BYTE";			break;
	case GL_SHORT:			t = "GL_SHORT";					break;
	case GL_UNSIGNED_SHORT:	t = "GL_UNSIGNED_SHORT";		break;
	case GL_INT:			t = "GL_INT";					break;
	case GL_UNSIGNED_INT:	t = "GL_UNSIGNED_INT";			break;
	case GL_FLOAT:			t = "GL_FLOAT";					break;
	case GL_DOUBLE:			t = "GL_DOUBLE";				break;
	default:				t = Str_VarArgs("0x%X", type);	break;
	}

	fprintf(qglState.logFile, "glColorPointer( %i, %s, %i, %p )\n", size, t, stride, pointer);
	dllColorPointer(size, type, stride, pointer);
}

static GLvoid APIENTRY logCopyPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum type){

	fprintf(qglState.logFile, "glCopyPixels( %i, %i, %i, %i, 0x%X )\n", x, y, width, height, type);
	dllCopyPixels(x, y, width, height, type);
}

static GLvoid APIENTRY logCopyTexImage1D (GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border){

	const char	*t, *i;

	switch (target){
	case GL_TEXTURE_1D:					t = "GL_TEXTURE_1D";						break;
	default:							t = Str_VarArgs("0x%X", target);			break;
	}

	switch (internalFormat){
	case GL_ALPHA:						i = "GL_ALPHA";								break;
	case GL_ALPHA4:						i = "GL_ALPHA4";							break;
	case GL_ALPHA8:						i = "GL_ALPHA8";							break;
	case GL_ALPHA12:					i = "GL_ALPHA12";							break;
	case GL_ALPHA16:					i = "GL_ALPHA16";							break;
	case GL_LUMINANCE:					i = "GL_LUMINANCE";							break;
	case GL_LUMINANCE4:					i = "GL_LUMINANCE4";						break;
	case GL_LUMINANCE8:					i = "GL_LUMINANCE8";						break;
	case GL_LUMINANCE12:				i = "GL_LUMINANCE12";						break;
	case GL_LUMINANCE16:				i = "GL_LUMINANCE16";						break;
	case GL_LUMINANCE_ALPHA:			i = "GL_LUMINANCE_ALPHA";					break;
	case GL_LUMINANCE4_ALPHA4:			i = "GL_LUMINANCE4_ALPHA4";					break;
	case GL_LUMINANCE6_ALPHA2:			i = "GL_LUMINANCE6_ALPHA2";					break;
	case GL_LUMINANCE8_ALPHA8:			i = "GL_LUMINANCE8_ALPHA8";					break;
	case GL_LUMINANCE12_ALPHA4:			i = "GL_LUMINANCE12_ALPHA4";				break;
	case GL_LUMINANCE12_ALPHA12:		i = "GL_LUMINANCE12_ALPHA12";				break;
	case GL_LUMINANCE16_ALPHA16:		i = "GL_LUMINANCE16_ALPHA16";				break;
	case GL_INTENSITY:					i = "GL_INTENSITY";							break;
	case GL_INTENSITY4:					i = "GL_INTENSITY4";						break;
	case GL_INTENSITY8:					i = "GL_INTENSITY8";						break;
	case GL_INTENSITY12:				i = "GL_INTENSITY12";						break;
	case GL_INTENSITY16:				i = "GL_INTENSITY16";						break;
	case GL_R3_G3_B2:					i = "GL_R3_G3_B2";							break;
	case GL_RGB:						i = "GL_RGB";								break;
	case GL_RGB4:						i = "GL_RGB4";								break;
	case GL_RGB5:						i = "GL_RGB5";								break;
	case GL_RGB8:						i = "GL_RGB8";								break;
	case GL_RGB10:						i = "GL_RGB10";								break;
	case GL_RGB12:						i = "GL_RGB12";								break;
	case GL_RGB16:						i = "GL_RGB16";								break;
	case GL_RGBA:						i = "GL_RGBA";								break;
	case GL_RGBA2:						i = "GL_RGBA2";								break;
	case GL_RGBA4:						i = "GL_RGBA4";								break;
	case GL_RGB5_A1:					i = "GL_RGB5_A1";							break;
	case GL_RGBA8:						i = "GL_RGBA8";								break;
	case GL_RGB10_A2:					i = "GL_RGB10_A2";							break;
	case GL_RGBA12:						i = "GL_RGBA12";							break;
	case GL_RGBA16:						i = "GL_RGBA16";							break;
	case GL_COMPRESSED_ALPHA:			i = "GL_COMPRESSED_ALPHA";					break;
	case GL_COMPRESSED_RGB:				i = "GL_COMPRESSED_RGB";					break;
	case GL_COMPRESSED_RGBA:			i = "GL_COMPRESSED_RGBA";					break;
	case GL_COMPRESSED_LUMINANCE:		i = "GL_COMPRESSED_LUMINANCE";				break;
	case GL_COMPRESSED_LUMINANCE_ALPHA:	i = "GL_COMPRESSED_LUMINANCE_ALPHA";		break;
	case GL_COMPRESSED_INTENSITY:		i = "GL_COMPRESSED_INTENSITY";				break;
	default:							i = Str_VarArgs("0x%X", internalFormat);	break;
	}

	fprintf(qglState.logFile, "glCopyTexImage1D( %s, %i, %s, %i, %i, %i, %i )\n", t, level, i, x, y, width, border);
	dllCopyTexImage1D(target, level, internalFormat, x, y, width, border);
}

static GLvoid APIENTRY logCopyTexImage2D (GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border){

	const char	*t, *i;

	switch (target){
	case GL_TEXTURE_2D:						t = "GL_TEXTURE_2D";						break;
	case GL_TEXTURE_CUBE_MAP_POSITIVE_X:	t = "GL_TEXTURE_CUBE_MAP_POSITIVE_X";		break;
	case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:	t = "GL_TEXTURE_CUBE_MAP_POSITIVE_Y";		break;
	case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:	t = "GL_TEXTURE_CUBE_MAP_POSITIVE_Z";		break;
	case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:	t = "GL_TEXTURE_CUBE_MAP_NEGATIVE_X";		break;
	case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:	t = "GL_TEXTURE_CUBE_MAP_NEGATIVE_Y";		break;
	case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:	t = "GL_TEXTURE_CUBE_MAP_NEGATIVE_Z";		break;
	default:								t = Str_VarArgs("0x%X", target);			break;
	}

	switch (internalFormat){
	case GL_ALPHA:							i = "GL_ALPHA";								break;
	case GL_ALPHA4:							i = "GL_ALPHA4";							break;
	case GL_ALPHA8:							i = "GL_ALPHA8";							break;
	case GL_ALPHA12:						i = "GL_ALPHA12";							break;
	case GL_ALPHA16:						i = "GL_ALPHA16";							break;
	case GL_LUMINANCE:						i = "GL_LUMINANCE";							break;
	case GL_LUMINANCE4:						i = "GL_LUMINANCE4";						break;
	case GL_LUMINANCE8:						i = "GL_LUMINANCE8";						break;
	case GL_LUMINANCE12:					i = "GL_LUMINANCE12";						break;
	case GL_LUMINANCE16:					i = "GL_LUMINANCE16";						break;
	case GL_LUMINANCE_ALPHA:				i = "GL_LUMINANCE_ALPHA";					break;
	case GL_LUMINANCE4_ALPHA4:				i = "GL_LUMINANCE4_ALPHA4";					break;
	case GL_LUMINANCE6_ALPHA2:				i = "GL_LUMINANCE6_ALPHA2";					break;
	case GL_LUMINANCE8_ALPHA8:				i = "GL_LUMINANCE8_ALPHA8";					break;
	case GL_LUMINANCE12_ALPHA4:				i = "GL_LUMINANCE12_ALPHA4";				break;
	case GL_LUMINANCE12_ALPHA12:			i = "GL_LUMINANCE12_ALPHA12";				break;
	case GL_LUMINANCE16_ALPHA16:			i = "GL_LUMINANCE16_ALPHA16";				break;
	case GL_INTENSITY:						i = "GL_INTENSITY";							break;
	case GL_INTENSITY4:						i = "GL_INTENSITY4";						break;
	case GL_INTENSITY8:						i = "GL_INTENSITY8";						break;
	case GL_INTENSITY12:					i = "GL_INTENSITY12";						break;
	case GL_INTENSITY16:					i = "GL_INTENSITY16";						break;
	case GL_R3_G3_B2:						i = "GL_R3_G3_B2";							break;
	case GL_RGB:							i = "GL_RGB";								break;
	case GL_RGB4:							i = "GL_RGB4";								break;
	case GL_RGB5:							i = "GL_RGB5";								break;
	case GL_RGB8:							i = "GL_RGB8";								break;
	case GL_RGB10:							i = "GL_RGB10";								break;
	case GL_RGB12:							i = "GL_RGB12";								break;
	case GL_RGB16:							i = "GL_RGB16";								break;
	case GL_RGBA:							i = "GL_RGBA";								break;
	case GL_RGBA2:							i = "GL_RGBA2";								break;
	case GL_RGBA4:							i = "GL_RGBA4";								break;
	case GL_RGB5_A1:						i = "GL_RGB5_A1";							break;
	case GL_RGBA8:							i = "GL_RGBA8";								break;
	case GL_RGB10_A2:						i = "GL_RGB10_A2";							break;
	case GL_RGBA12:							i = "GL_RGBA12";							break;
	case GL_RGBA16:							i = "GL_RGBA16";							break;
	case GL_COMPRESSED_ALPHA:				i = "GL_COMPRESSED_ALPHA";					break;
	case GL_COMPRESSED_RGB:					i = "GL_COMPRESSED_RGB";					break;
	case GL_COMPRESSED_RGBA:				i = "GL_COMPRESSED_RGBA";					break;
	case GL_COMPRESSED_LUMINANCE:			i = "GL_COMPRESSED_LUMINANCE";				break;
	case GL_COMPRESSED_LUMINANCE_ALPHA:		i = "GL_COMPRESSED_LUMINANCE_ALPHA";		break;
	case GL_COMPRESSED_INTENSITY:			i = "GL_COMPRESSED_INTENSITY";				break;
	default:								i = Str_VarArgs("0x%X", internalFormat);	break;
	}

	fprintf(qglState.logFile, "glCopyTexImage2D( %s, %i, %s, %i, %i, %i, %i, %i )\n", t, level, i, x, y, width, height, border);
	dllCopyTexImage2D(target, level, internalFormat, x, y, width, height, border);
}

static GLvoid APIENTRY logCopyTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width){

	const char	*t;

	switch (target){
	case GL_TEXTURE_1D:	t = "GL_TEXTURE_1D";				break;
	default:			t = Str_VarArgs("0x%X", target);	break;
	}

	fprintf(qglState.logFile, "glCopyTexSubImage1D( %s, %i, %i, %i, %i, %i)\n", t, level, xoffset, x, y, width);
	dllCopyTexSubImage1D(target, level, xoffset, x, y, width);
}

static GLvoid APIENTRY logCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height){

	const char	*t;

	switch (target){
	case GL_TEXTURE_2D:						t = "GL_TEXTURE_2D";					break;
	case GL_TEXTURE_CUBE_MAP_POSITIVE_X:	t = "GL_TEXTURE_CUBE_MAP_POSITIVE_X";	break;
	case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:	t = "GL_TEXTURE_CUBE_MAP_POSITIVE_Y";	break;
	case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:	t = "GL_TEXTURE_CUBE_MAP_POSITIVE_Z";	break;
	case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:	t = "GL_TEXTURE_CUBE_MAP_NEGATIVE_X";	break;
	case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:	t = "GL_TEXTURE_CUBE_MAP_NEGATIVE_Y";	break;
	case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:	t = "GL_TEXTURE_CUBE_MAP_NEGATIVE_Z";	break;
	default:								t = Str_VarArgs("0x%X", target);		break;
	}

	fprintf(qglState.logFile, "glCopyTexSubImage2D( %s, %i, %i, %i, %i, %i, %i, %i )\n", t, level, xoffset, yoffset, x, y, width, height);
	dllCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
}

static GLvoid APIENTRY logCullFace (GLenum mode){

	const char	*m;

	switch (mode){
	case GL_FRONT:			m = "GL_FRONT";					break;
	case GL_BACK:			m = "GL_BACK";					break;
	case GL_FRONT_AND_BACK:	m = "GL_FRONT_AND_BACK";		break;
	default:				m = Str_VarArgs("0x%X", mode);	break;
	}

	fprintf(qglState.logFile, "glCullFace( %s )\n", m);
	dllCullFace(mode);
}

static GLvoid APIENTRY logDeleteLists (GLuint list, GLsizei range){

	fprintf(qglState.logFile, "glDeleteLists( %u, %i )\n", list, range);
	dllDeleteLists(list, range);
}

static GLvoid APIENTRY logDeleteTextures (GLsizei n, const GLuint *textures){

	fprintf(qglState.logFile, "glDeleteTextures( %i, %p )\n", n, textures);
	dllDeleteTextures(n, textures);
}

static GLvoid APIENTRY logDepthFunc (GLenum func){

	const char	*f;

	switch (func){
	case GL_NEVER:		f = "GL_NEVER";					break;
	case GL_LESS:		f = "GL_LESS";					break;
	case GL_EQUAL:		f = "GL_EQUAL";					break;
	case GL_LEQUAL:		f = "GL_LEQUAL";				break;
	case GL_GREATER:	f = "GL_GREATER";				break;
	case GL_NOTEQUAL:	f = "GL_NOTEQUAL";				break;
	case GL_GEQUAL:		f = "GL_GEQUAL";				break;
	case GL_ALWAYS:		f = "GL_ALWAYS";				break;
	default:			f = Str_VarArgs("0x%X", func);	break;
	}

	fprintf(qglState.logFile, "glDepthFunc( %s )\n", f);
	dllDepthFunc(func);
}

static GLvoid APIENTRY logDepthMask (GLboolean flag){

	const char	*f;

	switch (flag){
	case GL_FALSE:	f = "GL_FALSE";					break;
	case GL_TRUE:	f = "GL_TRUE";					break;
	default:		f = Str_VarArgs("0x%X", flag);	break;
	}

	fprintf(qglState.logFile, "glDepthMask( %s )\n", f);
	dllDepthMask(flag);
}

static GLvoid APIENTRY logDepthRange (GLclampd zNear, GLclampd zFar){

	fprintf(qglState.logFile, "glDepthRange( %g, %g )\n", zNear, zFar);
	dllDepthRange(zNear, zFar);
}

static GLvoid APIENTRY logDisable (GLenum cap){

	const char	*c;

	switch (cap){
	case GL_ALPHA_TEST:					c = "GL_ALPHA_TEST";				break;
	case GL_BLEND:						c = "GL_BLEND";						break;
	case GL_COLOR_MATERIAL:				c = "GL_COLOR_MATERIAL";			break;
	case GL_CULL_FACE:					c = "GL_CULL_FACE";					break;
	case GL_DEPTH_BOUNDS_TEST_EXT:		c = "GL_DEPTH_BOUNDS_TEST_EXT";		break;
	case GL_DEPTH_TEST:					c = "GL_DEPTH_TEST";				break;
	case GL_DITHER:						c = "GL_DITHER";					break;
	case GL_FOG:						c = "GL_FOG";						break;
	case GL_LIGHTING:					c = "GL_LIGHTING";					break;
	case GL_MULTISAMPLE:				c = "GL_MULTISAMPLE";				break;
	case GL_NORMALIZE:					c = "GL_NORMALIZE";					break;
	case GL_POLYGON_OFFSET_FILL:		c = "GL_POLYGON_OFFSET_FILL";		break;
	case GL_POLYGON_OFFSET_LINE:		c = "GL_POLYGON_OFFSET_LINE";		break;
	case GL_POLYGON_OFFSET_POINT:		c = "GL_POLYGON_OFFSET_POINT";		break;
	case GL_SAMPLE_ALPHA_TO_COVERAGE:	c = "GL_SAMPLE_ALPHA_TO_COVERAGE";	break;
	case GL_STENCIL_TEST:				c = "GL_STENCIL_TEST";				break;
	case GL_SCISSOR_TEST:				c = "GL_SCISSOR_TEST";				break;
	case GL_TEXTURE_1D:					c = "GL_TEXTURE_1D";				break;
	case GL_TEXTURE_2D:					c = "GL_TEXTURE_2D";				break;
	case GL_TEXTURE_3D:					c = "GL_TEXTURE_3D";				break;
	case GL_TEXTURE_CUBE_MAP:			c = "GL_TEXTURE_CUBE_MAP";			break;
	case GL_TEXTURE_GEN_Q:				c = "GL_TEXTURE_GEN_Q";				break;
	case GL_TEXTURE_GEN_R:				c = "GL_TEXTURE_GEN_R";				break;
	case GL_TEXTURE_GEN_S:				c = "GL_TEXTURE_GEN_S";				break;
	case GL_TEXTURE_GEN_T:				c = "GL_TEXTURE_GEN_T";				break;
	default:							c = Str_VarArgs("0x%X", cap);		break;
	}

	if (cap >= GL_CLIP_PLANE0 && cap <= GL_CLIP_PLANE5)
		c = Str_VarArgs("GL_CLIP_PLANE%i", GL_CLIP_PLANE5 - cap);
	if (cap >= GL_LIGHT0 && cap <= GL_LIGHT7)
		c = Str_VarArgs("GL_LIGHT%i", GL_LIGHT7 - cap);

	fprintf(qglState.logFile, "glDisable( %s )\n", c);
	dllDisable(cap);
}

static GLvoid APIENTRY logDisableClientState (GLenum array){

	const char	*a;

	switch (array){
	case GL_COLOR_ARRAY:			a = "GL_COLOR_ARRAY";			break;
	case GL_TEXTURE_COORD_ARRAY:	a = "GL_TEXTURE_COORD_ARRAY";	break;
	case GL_NORMAL_ARRAY:			a = "GL_NORMAL_ARRAY";			break;
	case GL_VERTEX_ARRAY:			a = "GL_VERTEX_ARRAY";			break;
	default:						a = Str_VarArgs("0x%X", array);	break;
	}

	fprintf(qglState.logFile, "glDisableClientState( %s )\n", a);
	dllDisableClientState(array);
}

static GLvoid APIENTRY logDrawArrays (GLenum mode, GLint first, GLsizei count){

	const char	*m;

	switch (mode){
	case GL_POINTS:			m = "GL_POINTS";				break;
	case GL_LINES:			m = "GL_LINES";					break;
	case GL_LINE_STRIP:		m = "GL_LINE_STRIP";			break;
	case GL_LINE_LOOP:		m = "GL_LINE_LOOP";				break;
	case GL_TRIANGLES:		m = "GL_TRIANGLES";				break;
	case GL_TRIANGLE_STRIP: m = "GL_TRIANGLE_STRIP";		break;
	case GL_TRIANGLE_FAN:	m = "GL_TRIANGLE_FAN";			break;
	case GL_QUADS:			m = "GL_QUADS";					break;
	case GL_QUAD_STRIP:		m = "GL_QUAD_STRIP";			break;
	case GL_POLYGON:		m = "GL_POLYGON";				break;
	default:				m = Str_VarArgs("0x%X", mode);	break;
	}

	fprintf(qglState.logFile, "glDrawArrays( %s, %i, %i )\n", m, first, count);
	dllDrawArrays(mode, first, count);
}

static GLvoid APIENTRY logDrawBuffer (GLenum mode){

	const char	*m;

	switch (mode){
	case GL_NONE:			m = "GL_NONE";					break;
	case GL_FRONT_LEFT:		m = "GL_FRONT_LEFT";			break;
	case GL_FRONT_RIGHT:	m = "GL_FRONT_RIGHT";			break;
	case GL_BACK_LEFT:		m = "GL_BACK_LEFT";				break;
	case GL_BACK_RIGHT:		m = "GL_BACK_RIGHT";			break;
	case GL_FRONT:			m = "GL_FRONT";					break;
	case GL_BACK:			m = "GL_BACK";					break;
	case GL_LEFT:			m = "GL_LEFT";					break;
	case GL_RIGHT:			m = "GL_RIGHT";					break;
	case GL_FRONT_AND_BACK:	m = "GL_FRONT_AND_BACK";		break;
	default:				m = Str_VarArgs("0x%X", mode);	break;
	}

	fprintf(qglState.logFile, "glDrawBuffer( %s )\n", m);
	dllDrawBuffer(mode);
}

static GLvoid APIENTRY logDrawElements (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices){

	const char	*m, *t;

	switch (mode){
	case GL_POINTS:			m = "GL_POINTS";				break;
	case GL_LINES:			m = "GL_LINES";					break;
	case GL_LINE_STRIP:		m = "GL_LINE_STRIP";			break;
	case GL_LINE_LOOP:		m = "GL_LINE_LOOP";				break;
	case GL_TRIANGLES:		m = "GL_TRIANGLES";				break;
	case GL_TRIANGLE_STRIP:	m = "GL_TRIANGLE_STRIP";		break;
	case GL_TRIANGLE_FAN:	m = "GL_TRIANGLE_FAN";			break;
	case GL_QUADS:			m = "GL_QUADS";					break;
	case GL_QUAD_STRIP:		m = "GL_QUAD_STRIP";			break;
	case GL_POLYGON:		m = "GL_POLYGON";				break;
	default:				m = Str_VarArgs("0x%X", mode);	break;
	}

	switch (type){
	case GL_BYTE:			t = "GL_BYTE";					break;
	case GL_UNSIGNED_BYTE:	t = "GL_UNSIGNED_BYTE";			break;
	case GL_SHORT:			t = "GL_SHORT";					break;
	case GL_UNSIGNED_SHORT:	t = "GL_UNSIGNED_SHORT";		break;
	case GL_INT:			t = "GL_INT";					break;
	case GL_UNSIGNED_INT:	t = "GL_UNSIGNED_INT";			break;
	case GL_FLOAT:			t = "GL_FLOAT";					break;
	case GL_DOUBLE:			t = "GL_DOUBLE";				break;
	default:				t = Str_VarArgs("0x%X", type);	break;
	}

	fprintf(qglState.logFile, "glDrawElements( %s, %i, %s, %p )\n", m, count, t, indices);
	dllDrawElements(mode, count, type, indices);
}

static GLvoid APIENTRY logDrawPixels (GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels){

	fprintf(qglState.logFile, "glDrawPixels( %i, %i, 0x%X, 0x%X, %p )\n", width, height, format, type, pixels);
	dllDrawPixels(width, height, format, type, pixels);
}

static GLvoid APIENTRY logEdgeFlag (GLboolean flag){

	const char	*f;

	switch (flag){
	case GL_FALSE:	f = "GL_FALSE";					break;
	case GL_TRUE:	f = "GL_TRUE";					break;
	default:		f = Str_VarArgs("0x%X", flag);	break;
	}

	fprintf(qglState.logFile, "glEdgeFlag( %s )\n", f);
	dllEdgeFlag(flag);
}

static GLvoid APIENTRY logEdgeFlagPointer (GLsizei stride, const GLvoid *pointer){

	fprintf(qglState.logFile, "glEdgeFlagPointer( %i, %p )\n", stride, pointer);
	dllEdgeFlagPointer(stride, pointer);
}

static GLvoid APIENTRY logEdgeFlagv (const GLboolean *flag){

	fprintf(qglState.logFile, "glEdgeFlagv( %p )\n", flag);
	dllEdgeFlagv(flag);
}

static GLvoid APIENTRY logEnable (GLenum cap){

	const char	*c;

	switch (cap){
	case GL_ALPHA_TEST:					c = "GL_ALPHA_TEST";				break;
	case GL_BLEND:						c = "GL_BLEND";						break;
	case GL_COLOR_MATERIAL:				c = "GL_COLOR_MATERIAL";			break;
	case GL_CULL_FACE:					c = "GL_CULL_FACE";					break;
	case GL_DEPTH_BOUNDS_TEST_EXT:		c = "GL_DEPTH_BOUNDS_TEST_EXT";		break;
	case GL_DEPTH_TEST:					c = "GL_DEPTH_TEST";				break;
	case GL_DITHER:						c = "GL_DITHER";					break;
	case GL_FOG:						c = "GL_FOG";						break;
	case GL_LIGHTING:					c = "GL_LIGHTING";					break;
	case GL_MULTISAMPLE:				c = "GL_MULTISAMPLE";				break;
	case GL_NORMALIZE:					c = "GL_NORMALIZE";					break;
	case GL_POLYGON_OFFSET_FILL:		c = "GL_POLYGON_OFFSET_FILL";		break;
	case GL_POLYGON_OFFSET_LINE:		c = "GL_POLYGON_OFFSET_LINE";		break;
	case GL_POLYGON_OFFSET_POINT:		c = "GL_POLYGON_OFFSET_POINT";		break;
	case GL_SAMPLE_ALPHA_TO_COVERAGE:	c = "GL_SAMPLE_ALPHA_TO_COVERAGE";	break;
	case GL_STENCIL_TEST:				c = "GL_STENCIL_TEST";				break;
	case GL_SCISSOR_TEST:				c = "GL_SCISSOR_TEST";				break;
	case GL_TEXTURE_1D:					c = "GL_TEXTURE_1D";				break;
	case GL_TEXTURE_2D:					c = "GL_TEXTURE_2D";				break;
	case GL_TEXTURE_3D:					c = "GL_TEXTURE_3D";				break;
	case GL_TEXTURE_CUBE_MAP:			c = "GL_TEXTURE_CUBE_MAP";			break;
	case GL_TEXTURE_GEN_Q:				c = "GL_TEXTURE_GEN_Q";				break;
	case GL_TEXTURE_GEN_R:				c = "GL_TEXTURE_GEN_R";				break;
	case GL_TEXTURE_GEN_S:				c = "GL_TEXTURE_GEN_S";				break;
	case GL_TEXTURE_GEN_T:				c = "GL_TEXTURE_GEN_T";				break;
	default:							c = Str_VarArgs("0x%X", cap);		break;
	}

	if (cap >= GL_CLIP_PLANE0 && cap <= GL_CLIP_PLANE5)
		c = Str_VarArgs("GL_CLIP_PLANE%i", GL_CLIP_PLANE5 - cap);
	if (cap >= GL_LIGHT0 && cap <= GL_LIGHT7)
		c = Str_VarArgs("GL_LIGHT%i", GL_LIGHT7 - cap);

	fprintf(qglState.logFile, "glEnable( %s )\n", c);
	dllEnable(cap);
}

static GLvoid APIENTRY logEnableClientState (GLenum array){

	const char	*a;

	switch (array){
	case GL_COLOR_ARRAY:			a = "GL_COLOR_ARRAY";			break;
	case GL_TEXTURE_COORD_ARRAY:	a = "GL_TEXTURE_COORD_ARRAY";	break;
	case GL_NORMAL_ARRAY:			a = "GL_NORMAL_ARRAY";			break;
	case GL_VERTEX_ARRAY:			a = "GL_VERTEX_ARRAY";			break;
	default:						a = Str_VarArgs("0x%X", array);	break;
	}

	fprintf(qglState.logFile, "glEnableClientState( %s )\n", a);
	dllEnableClientState(array);
}

static GLvoid APIENTRY logEnd (GLvoid){

	fprintf(qglState.logFile, "glEnd()\n");
	dllEnd();
}

static GLvoid APIENTRY logEndList (GLvoid){

	fprintf(qglState.logFile, "glEndList()\n");
	dllEndList();
}

static GLvoid APIENTRY logEvalCoord1d (GLdouble u){

	fprintf(qglState.logFile, "glEvalCoord1d( %g )\n", u);
	dllEvalCoord1d(u);
}

static GLvoid APIENTRY logEvalCoord1dv (const GLdouble *u){

	fprintf(qglState.logFile, "glEvalCoord1dv( %p )\n", u);
	dllEvalCoord1dv(u);
}

static GLvoid APIENTRY logEvalCoord1f (GLfloat u){

	fprintf(qglState.logFile, "glEvalCoord1f( %g )\n", u);
	dllEvalCoord1f(u);
}

static GLvoid APIENTRY logEvalCoord1fv (const GLfloat *u){

	fprintf(qglState.logFile, "glEvalCoord1fv( %p )\n", u);
	dllEvalCoord1fv(u);
}

static GLvoid APIENTRY logEvalCoord2d (GLdouble u, GLdouble v){

	fprintf(qglState.logFile, "glEvalCoord2d( %g, %g )\n", u, v);
	dllEvalCoord2d(u, v);
}

static GLvoid APIENTRY logEvalCoord2dv (const GLdouble *u){

	fprintf(qglState.logFile, "glEvalCoord2dv( %p )\n", u);
	dllEvalCoord2dv(u);
}

static GLvoid APIENTRY logEvalCoord2f (GLfloat u, GLfloat v){

	fprintf(qglState.logFile, "glEvalCoord2f( %g, %g )\n", u, v);
	dllEvalCoord2f(u, v);
}

static GLvoid APIENTRY logEvalCoord2fv (const GLfloat *u){

	fprintf(qglState.logFile, "glEvalCoord2fv( %p )\n", u);
	dllEvalCoord2fv(u);
}

static GLvoid APIENTRY logEvalMesh1 (GLenum mode, GLint i1, GLint i2){

	fprintf(qglState.logFile, "glEvalMesh1( 0x%X, %i, %i )\n", mode, i1, i2);
	dllEvalMesh1(mode, i1, i2);
}

static GLvoid APIENTRY logEvalMesh2 (GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2){

	fprintf(qglState.logFile, "glEvalMesh2( 0x%X, %i, %i, %i, %i )\n", mode, i1, i2, j1, j2);
	dllEvalMesh2(mode, i1, i2, j1, j2);
}

static GLvoid APIENTRY logEvalPoint1 (GLint i){

	fprintf(qglState.logFile, "glEvalPoint1( %i )\n", i);
	dllEvalPoint1(i);
}

static GLvoid APIENTRY logEvalPoint2 (GLint i, GLint j){

	fprintf(qglState.logFile, "glEvalPoint2( %i, %i )\n", i, j);
	dllEvalPoint2(i, j);
}

static GLvoid APIENTRY logFeedbackBuffer (GLsizei size, GLenum type, GLfloat *buffer){

	fprintf(qglState.logFile, "glFeedbackBuffer( %i, 0x%X, %p )\n", size, type, buffer);
	dllFeedbackBuffer(size, type, buffer);
}

static GLvoid APIENTRY logFinish (GLvoid){

	fprintf(qglState.logFile, "glFinish()\n");
	dllFinish();
}

static GLvoid APIENTRY logFlush (GLvoid){

	fprintf(qglState.logFile, "glFlush()\n");
	dllFlush();
}

static GLvoid APIENTRY logFogf (GLenum pname, GLfloat param){

	fprintf(qglState.logFile, "glFogf( 0x%X, %f )\n", pname, param);
	dllFogf(pname, param);
}

static GLvoid APIENTRY logFogfv (GLenum pname, const GLfloat *params){

	fprintf(qglState.logFile, "glFogfv( 0x%X, %p )\n", pname, params);
	dllFogfv(pname, params);
}

static GLvoid APIENTRY logFogi (GLenum pname, GLint param){

	fprintf(qglState.logFile, "glFogi( 0x%X, %i )\n", pname, param);
	dllFogi(pname, param);
}

static GLvoid APIENTRY logFogiv (GLenum pname, const GLint *params){

	fprintf(qglState.logFile, "glFogiv( 0x%X, %p )\n", pname, params);
	dllFogiv(pname, params);
}

static GLvoid APIENTRY logFrontFace (GLenum mode){

	const char	*m;

	switch (mode){
	case GL_CW:		m = "GL_CW";					break;
	case GL_CCW:	m = "GL_CCW";					break;
	default:		m = Str_VarArgs("0x%X", mode);	break;
	}

	fprintf(qglState.logFile, "glFrontFace( %s )\n", m);
	dllFrontFace(mode);
}

static GLvoid APIENTRY logFrustum (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar){

	fprintf(qglState.logFile, "glFrustum( %g, %g, %g, %g, %g, %g )\n", left, right, bottom, top, zNear, zFar);
	dllFrustum(left, right, bottom, top, zNear, zFar);
}

static GLuint APIENTRY logGenLists (GLsizei range){

	fprintf(qglState.logFile, "glGenLists( %i )\n", range);
	return dllGenLists(range);
}

static GLvoid APIENTRY logGenTextures (GLsizei n, GLuint *textures){

	fprintf(qglState.logFile, "glGenTextures( %i, %p )\n", n, textures);
	dllGenTextures(n, textures);
}

static GLvoid APIENTRY logGetBooleanv (GLenum pname, GLboolean *params){

	fprintf(qglState.logFile, "glGetBooleanv( 0x%X, %p )\n", pname, params);
	dllGetBooleanv(pname, params);
}

static GLvoid APIENTRY logGetClipPlane (GLenum plane, GLdouble *equation){

	fprintf(qglState.logFile, "glGetClipPlane( 0x%X, %p )\n", plane, equation);
	dllGetClipPlane(plane, equation);
}

static GLvoid APIENTRY logGetDoublev (GLenum pname, GLdouble *params){

	fprintf(qglState.logFile, "glGetDoublev( 0x%X, %p )\n", pname, params);
	dllGetDoublev(pname, params);
}

static GLenum APIENTRY logGetError (GLvoid){

	fprintf(qglState.logFile, "glGetError()\n");
	return dllGetError();
}

static GLvoid APIENTRY logGetFloatv (GLenum pname, GLfloat *params){

	fprintf(qglState.logFile, "glGetFloatv( 0x%X, %p )\n", pname, params);
	dllGetFloatv(pname, params);
}

static GLvoid APIENTRY logGetIntegerv (GLenum pname, GLint *params){

	fprintf(qglState.logFile, "glGetIntegerv( 0x%X, %p )\n", pname, params);
	dllGetIntegerv(pname, params);
}

static GLvoid APIENTRY logGetLightfv (GLenum light, GLenum pname, GLfloat *params){

	fprintf(qglState.logFile, "glGetLightfv( 0x%X, 0x%X, %p )\n", light, pname, params);
	dllGetLightfv(light, pname, params);
}

static GLvoid APIENTRY logGetLightiv (GLenum light, GLenum pname, GLint *params){

	fprintf(qglState.logFile, "glGetLightiv( 0x%X, 0x%X, %p )\n", light, pname, params);
	dllGetLightiv(light, pname, params);
}

static GLvoid APIENTRY logGetMapdv (GLenum target, GLenum query, GLdouble *v){

	fprintf(qglState.logFile, "glGetMapdv( 0x%X, 0x%X, %p )\n", target, query, v);
	dllGetMapdv(target, query, v);
}

static GLvoid APIENTRY logGetMapfv (GLenum target, GLenum query, GLfloat *v){

	fprintf(qglState.logFile, "glGetMapfv( 0x%X, 0x%X, %p )\n", target, query, v);
	dllGetMapfv(target, query, v);
}

static GLvoid APIENTRY logGetMapiv (GLenum target, GLenum query, GLint *v){

	fprintf(qglState.logFile, "glGetMapiv( 0x%X, 0x%X, %p )\n", target, query, v);
	dllGetMapiv(target, query, v);
}

static GLvoid APIENTRY logGetMaterialfv (GLenum face, GLenum pname, GLfloat *params){

	fprintf(qglState.logFile, "glGetMaterialfv( 0x%X, 0x%X, %p )\n", face, pname, params);
	dllGetMaterialfv(face, pname, params);
}

static GLvoid APIENTRY logGetMaterialiv (GLenum face, GLenum pname, GLint *params){

	fprintf(qglState.logFile, "glGetMaterialiv( 0x%X, 0x%X, %p )\n", face, pname, params);
	dllGetMaterialiv(face, pname, params);
}

static GLvoid APIENTRY logGetPixelMapfv (GLenum map, GLfloat *values){

	fprintf(qglState.logFile, "glGetPixelMapfv( 0x%X, %p )\n", map, values);
	dllGetPixelMapfv(map, values);
}

static GLvoid APIENTRY logGetPixelMapuiv (GLenum map, GLuint *values){

	fprintf(qglState.logFile, "glGetPixelMapuiv( 0x%X, %p )\n", map, values);
	dllGetPixelMapuiv(map, values);
}

static GLvoid APIENTRY logGetPixelMapusv (GLenum map, GLushort *values){

	fprintf(qglState.logFile, "glGetPixelMapusv( 0x%X, %p )\n", map, values);
	dllGetPixelMapusv(map, values);
}

static GLvoid APIENTRY logGetPointerv (GLenum pname, GLvoid **params){

	fprintf(qglState.logFile, "glGetPointerv( 0x%X, %p )\n", pname, params);
	dllGetPointerv(pname, params);
}

static GLvoid APIENTRY logGetPolygonStipple (GLubyte *mask){

	fprintf(qglState.logFile, "glGetPolygonStipple( %p )\n", mask);
	dllGetPolygonStipple(mask);
}

static const GLubyte * APIENTRY logGetString (GLenum name){

	fprintf(qglState.logFile, "glGetString( 0x%X )\n", name);
	return dllGetString(name);
}

static GLvoid APIENTRY logGetTexEnvfv (GLenum target, GLenum pname, GLfloat *params){

	fprintf(qglState.logFile, "glGetTexEnvfv( 0x%X, 0x%X, %p )\n", target, pname, params);
	dllGetTexEnvfv(target, pname, params);
}

static GLvoid APIENTRY logGetTexEnviv (GLenum target, GLenum pname, GLint *params){

	fprintf(qglState.logFile, "glGetTexEnviv( 0x%X, 0x%X, %p )\n", target, pname, params);
	dllGetTexEnviv(target, pname, params);
}

static GLvoid APIENTRY logGetTexGendv (GLenum coord, GLenum pname, GLdouble *params){

	fprintf(qglState.logFile, "glGetTexGendv( 0x%X, 0x%X, %p )\n", coord, pname, params);
	dllGetTexGendv(coord, pname, params);
}

static GLvoid APIENTRY logGetTexGenfv (GLenum coord, GLenum pname, GLfloat *params){

	fprintf(qglState.logFile, "glGetTexGenfv( 0x%X, 0x%X, %p )\n", coord, pname, params);
	dllGetTexGenfv(coord, pname, params);
}

static GLvoid APIENTRY logGetTexGeniv (GLenum coord, GLenum pname, GLint *params){

	fprintf(qglState.logFile, "glGetTexGeniv( 0x%X, 0x%X, %p )\n", coord, pname, params);
	dllGetTexGeniv(coord, pname, params);
}

static GLvoid APIENTRY logGetTexImage (GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels){

	fprintf(qglState.logFile, "glGetTexImage( 0x%X, %i, 0x%X, 0x%X, %p )\n", target, level, format, type, pixels);
	dllGetTexImage(target, level, format, type, pixels);
}

static GLvoid APIENTRY logGetTexLevelParameterfv (GLenum target, GLint level, GLenum pname, GLfloat *params){

	fprintf(qglState.logFile, "glGetTexLevelParameterfv( 0x%X, %i, 0x%X, %p )\n", target, level, pname, params);
	dllGetTexLevelParameterfv(target, level, pname, params);
}

static GLvoid APIENTRY logGetTexLevelParameteriv (GLenum target, GLint level, GLenum pname, GLint *params){

	fprintf(qglState.logFile, "glGetTexLevelParameteriv( 0x%X, %i, 0x%X, %p )\n", target, level, pname, params);
	dllGetTexLevelParameteriv(target, level, pname, params);
}

static GLvoid APIENTRY logGetTexParameterfv (GLenum target, GLenum pname, GLfloat *params){

	fprintf(qglState.logFile, "glGetTexParameterfv( 0x%X, 0x%X, %p )\n", target, pname, params);
	dllGetTexParameterfv(target, pname, params);
}

static GLvoid APIENTRY logGetTexParameteriv (GLenum target, GLenum pname, GLint *params){

	fprintf(qglState.logFile, "glGetTexParameteriv( 0x%X, 0x%X, %p )\n", target, pname, params);
	dllGetTexParameteriv(target, pname, params);
}

static GLvoid APIENTRY logHint (GLenum target, GLenum mode){

	fprintf(qglState.logFile, "glHint( 0x%X, 0x%X )\n", target, mode);
	dllHint(target, mode);
}

static GLvoid APIENTRY logIndexMask (GLuint mask){

	fprintf(qglState.logFile, "glIndexMask( %u )\n", mask);
	dllIndexMask(mask);
}

static GLvoid APIENTRY logIndexPointer (GLenum type, GLsizei stride, const GLvoid *pointer){

	fprintf(qglState.logFile, "glIndexPointer( 0x%X, %i, %p )\n", type, stride, pointer);
	dllIndexPointer(type, stride, pointer);
}

static GLvoid APIENTRY logIndexd (GLdouble c){

	fprintf(qglState.logFile, "glIndexd( %g )\n", c);
	dllIndexd(c);
}

static GLvoid APIENTRY logIndexdv (const GLdouble *c){

	fprintf(qglState.logFile, "glIndexdv( %p )\n", c);
	dllIndexdv(c);
}

static GLvoid APIENTRY logIndexf (GLfloat c){

	fprintf(qglState.logFile, "glIndexf( %g )\n", c);
	dllIndexf(c);
}

static GLvoid APIENTRY logIndexfv (const GLfloat *c){

	fprintf(qglState.logFile, "glIndexfv( %p )\n", c);
	dllIndexfv(c);
}

static GLvoid APIENTRY logIndexi (GLint c){

	fprintf(qglState.logFile, "glIndexi( %i )\n", c);
	dllIndexi(c);
}

static GLvoid APIENTRY logIndexiv (const GLint *c){

	fprintf(qglState.logFile, "glIndexiv( %p )\n", c);
	dllIndexiv(c);
}

static GLvoid APIENTRY logIndexs (GLshort c){

	fprintf(qglState.logFile, "glIndexs( %i )\n", c);
	dllIndexs(c);
}

static GLvoid APIENTRY logIndexsv (const GLshort *c){

	fprintf(qglState.logFile, "glIndexsv( %p )\n", c);
	dllIndexsv(c);
}

static GLvoid APIENTRY logIndexub (GLubyte c){

	fprintf(qglState.logFile, "glIndexub( %u )\n", c);
	dllIndexub(c);
}

static GLvoid APIENTRY logIndexubv (const GLubyte *c){

	fprintf(qglState.logFile, "glIndexubv( %p )\n", c);
	dllIndexubv(c);
}

static GLvoid APIENTRY logInitNames (GLvoid){

	fprintf(qglState.logFile, "glInitNames()\n");
	dllInitNames();
}

static GLvoid APIENTRY logInterleavedArrays (GLenum format, GLsizei stride, const GLvoid *pointer){

	fprintf(qglState.logFile, "glInterleavedArrays( 0x%X, %i, %p )\n", format, stride, pointer);
	dllInterleavedArrays(format, stride, pointer);
}

static GLboolean APIENTRY logIsEnabled (GLenum cap){

	fprintf(qglState.logFile, "glIsEnabled( 0x%X )\n", cap);
	return dllIsEnabled(cap);
}

static GLboolean APIENTRY logIsList (GLuint list){

	fprintf(qglState.logFile, "glIsList( %u )\n", list);
	return dllIsList(list);
}

static GLboolean APIENTRY logIsTexture (GLuint texture){

	fprintf(qglState.logFile, "glIsTexture( %u )\n", texture);
	return dllIsTexture(texture);
}

static GLvoid APIENTRY logLightModelf (GLenum pname, GLfloat param){

	fprintf(qglState.logFile, "glLightModelf( 0x%X, %g )\n", pname, param);
	dllLightModelf(pname, param);
}

static GLvoid APIENTRY logLightModelfv (GLenum pname, const GLfloat *params){

	fprintf(qglState.logFile, "glLightModelfv( 0x%X, %p )\n", pname, params);
	dllLightModelfv(pname, params);
}

static GLvoid APIENTRY logLightModeli (GLenum pname, GLint param){

	fprintf(qglState.logFile, "glLightModeli( 0x%X, %i )\n", pname, param);
	dllLightModeli(pname, param);
}

static GLvoid APIENTRY logLightModeliv (GLenum pname, const GLint *params){

	fprintf(qglState.logFile, "glLightModeliv( 0x%X, %p )\n", pname, params);
	dllLightModeliv(pname, params);
}

static GLvoid APIENTRY logLightf (GLenum light, GLenum pname, GLfloat param){

	fprintf(qglState.logFile, "glLightf( 0x%X, 0x%X, %g )\n", light, pname, param);
	dllLightf(light, pname, param);
}

static GLvoid APIENTRY logLightfv (GLenum light, GLenum pname, const GLfloat *params){

	fprintf(qglState.logFile, "glLightfv( 0x%X, 0x%X, %p )\n", light, pname, params);
	dllLightfv(light, pname, params);
}

static GLvoid APIENTRY logLighti (GLenum light, GLenum pname, GLint param){

	fprintf(qglState.logFile, "glLighti( 0x%X, 0x%X, %i )\n", light, pname, param);
	dllLighti(light, pname, param);
}

static GLvoid APIENTRY logLightiv (GLenum light, GLenum pname, const GLint *params){

	fprintf(qglState.logFile, "glLightiv( 0x%X, 0x%X, %p )\n", light, pname, params);
	dllLightiv(light, pname, params);
}

static GLvoid APIENTRY logLineStipple (GLint factor, GLushort pattern){

	fprintf(qglState.logFile, "glLineStipple( %i, %u )\n", factor, pattern);
	dllLineStipple(factor, pattern);
}

static GLvoid APIENTRY logLineWidth (GLfloat width){

	fprintf(qglState.logFile, "glLineWidth( %g )\n", width);
	dllLineWidth(width);
}

static GLvoid APIENTRY logListBase (GLuint base){

	fprintf(qglState.logFile, "glListBase( %u )\n", base);
	dllListBase(base);
}

static GLvoid APIENTRY logLoadIdentity (GLvoid){

	fprintf(qglState.logFile, "glLoadIdentity()\n");
	dllLoadIdentity();
}

static GLvoid APIENTRY logLoadMatrixd (const GLdouble *m){

	fprintf(qglState.logFile, "glLoadMatrixd( %p )\n", m);
	dllLoadMatrixd(m);
}

static GLvoid APIENTRY logLoadMatrixf (const GLfloat *m){

	fprintf(qglState.logFile, "glLoadMatrixf( %p )\n", m);
	dllLoadMatrixf(m);
}

static GLvoid APIENTRY logLoadName (GLuint name){

	fprintf(qglState.logFile, "glLoadName( %u )\n", name);
	dllLoadName(name);
}

static GLvoid APIENTRY logLogicOp (GLenum opcode){

	fprintf(qglState.logFile, "glLogicOp( 0x%X )\n", opcode);
	dllLogicOp(opcode);
}

static GLvoid APIENTRY logMap1d (GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points){

	fprintf(qglState.logFile, "glMap1d( 0x%X, %g, %g, %i, %i, %p )\n", target, u1, u2, stride, order, points);
	dllMap1d(target, u1, u2, stride, order, points);
}

static GLvoid APIENTRY logMap1f (GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points){

	fprintf(qglState.logFile, "glMap1f( 0x%X, %g, %g, %i, %i, %p )\n", target, u1, u2, stride, order, points);
	dllMap1f(target, u1, u2, stride, order, points);
}

static GLvoid APIENTRY logMap2d (GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points){

	fprintf(qglState.logFile, "glMap2d( 0x%X, %g, %g, %i, %i, %g, %g, %i, %i, %p )\n", target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points);
	dllMap2d(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points);
}

static GLvoid APIENTRY logMap2f (GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points){

	fprintf(qglState.logFile, "glMap2f( 0x%X, %g, %g, %i, %i, %g, %g, %i, %i, %p )\n", target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points);
	dllMap2f(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points);
}

static GLvoid APIENTRY logMapGrid1d (GLint un, GLdouble u1, GLdouble u2){

	fprintf(qglState.logFile, "glMapGrid1d( %i, %g, %g )\n", un, u1, u2);
	dllMapGrid1d(un, u1, u2);
}

static GLvoid APIENTRY logMapGrid1f (GLint un, GLfloat u1, GLfloat u2){

	fprintf(qglState.logFile, "glMapGrid1f( %i, %g, %g )\n", un, u1, u2);
	dllMapGrid1f(un, u1, u2);
}

static GLvoid APIENTRY logMapGrid2d (GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2){

	fprintf(qglState.logFile, "glMapGrid2d( %i, %g, %g, %i, %g, %g )\n", un, u1, u2, vn, v1, v2);
	dllMapGrid2d(un, u1, u2, vn, v1, v2);
}

static GLvoid APIENTRY logMapGrid2f (GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2){

	fprintf(qglState.logFile, "glMapGrid2f( %i, %g, %g, %i, %g, %g )\n", un, u1, u2, vn, v1, v2);
	dllMapGrid2f(un, u1, u2, vn, v1, v2);
}

static GLvoid APIENTRY logMaterialf (GLenum face, GLenum pname, GLfloat param){

	fprintf(qglState.logFile, "glMaterialf( 0x%X, 0x%X, %g )\n", face, pname, param);
	dllMaterialf(face, pname, param);
}

static GLvoid APIENTRY logMaterialfv (GLenum face, GLenum pname, const GLfloat *params){

	fprintf(qglState.logFile, "glMaterialfv( 0x%X, 0x%X, %p )\n", face, pname, params);
	dllMaterialfv(face, pname, params);
}

static GLvoid APIENTRY logMateriali (GLenum face, GLenum pname, GLint param){

	fprintf(qglState.logFile, "glMateriali( 0x%X, 0x%X, %i )\n", face, pname, param);
	dllMateriali(face, pname, param);
}

static GLvoid APIENTRY logMaterialiv (GLenum face, GLenum pname, const GLint *params){

	fprintf(qglState.logFile, "glMaterialiv( 0x%X, 0x%X, %p )\n", face, pname, params);
	dllMaterialiv(face, pname, params);
}

static GLvoid APIENTRY logMatrixMode (GLenum mode){

	const char	*m;

	switch (mode){
	case GL_PROJECTION:	m = "GL_PROJECTION";			break;
	case GL_MODELVIEW:	m = "GL_MODELVIEW";				break;
	case GL_TEXTURE:	m = "GL_TEXTURE";				break;
	default:			m = Str_VarArgs("0x%X", mode);	break;
	}

	fprintf(qglState.logFile, "glMatrixMode( %s )\n", m);
	dllMatrixMode(mode);
}

static GLvoid APIENTRY logMultMatrixd (const GLdouble *m){

	fprintf(qglState.logFile, "glMultMatrixd( %p )\n", m);
	dllMultMatrixd(m);
}

static GLvoid APIENTRY logMultMatrixf (const GLfloat *m){

	fprintf(qglState.logFile, "glMultMatrixf( %p )\n", m);
	dllMultMatrixf(m);
}

static GLvoid APIENTRY logNewList (GLuint list, GLenum mode){

	fprintf(qglState.logFile, "glNewList( %u, 0x%X )\n", list, mode);
	dllNewList(list, mode);
}

static GLvoid APIENTRY logNormal3b (GLbyte nx, GLbyte ny, GLbyte nz){

	fprintf(qglState.logFile, "glNormal3b( %i, %i, %i )\n", nx, ny, nz);
	dllNormal3b(nx, ny, nz);
}

static GLvoid APIENTRY logNormal3bv (const GLbyte *v){

	fprintf(qglState.logFile, "glNormal3bv( %p )\n", v);
	dllNormal3bv(v);
}

static GLvoid APIENTRY logNormal3d (GLdouble nx, GLdouble ny, GLdouble nz){

	fprintf(qglState.logFile, "glNormal3d( %g, %g, %g )\n", nx, ny, nz);
	dllNormal3d(nx, ny, nz);
}

static GLvoid APIENTRY logNormal3dv (const GLdouble *v){

	fprintf(qglState.logFile, "glNormal3dv( %p )\n", v);
	dllNormal3dv(v);
}

static GLvoid APIENTRY logNormal3f (GLfloat nx, GLfloat ny, GLfloat nz){

	fprintf(qglState.logFile, "glNormal3f( %g, %g, %g )\n", nx, ny, nz);
	dllNormal3f(nx, ny, nz);
}

static GLvoid APIENTRY logNormal3fv (const GLfloat *v){

	fprintf(qglState.logFile, "glNormal3fv( %p )\n", v);
	dllNormal3fv(v);
}

static GLvoid APIENTRY logNormal3i (GLint nx, GLint ny, GLint nz){

	fprintf(qglState.logFile, "glNormal3i( %i, %i, %i )\n", nx, ny, nz);
	dllNormal3i(nx, ny, nz);
}

static GLvoid APIENTRY logNormal3iv (const GLint *v){

	fprintf(qglState.logFile, "glNormal3iv( %p )\n", v);
	dllNormal3iv(v);
}

static GLvoid APIENTRY logNormal3s (GLshort nx, GLshort ny, GLshort nz){

	fprintf(qglState.logFile, "glNormal3s( %i, %i, %i )\n", nx, ny, nz);
	dllNormal3s(nx, ny, nz);
}

static GLvoid APIENTRY logNormal3sv (const GLshort *v){

	fprintf(qglState.logFile, "glNormal3sv( %p )\n", v);
	dllNormal3sv(v);
}

static GLvoid APIENTRY logNormalPointer (GLenum type, GLsizei stride, const GLvoid *pointer){

	const char	*t;

	switch (type){
	case GL_BYTE:			t = "GL_BYTE";					break;
	case GL_UNSIGNED_BYTE:	t = "GL_UNSIGNED_BYTE";			break;
	case GL_SHORT:			t = "GL_SHORT";					break;
	case GL_UNSIGNED_SHORT:	t = "GL_UNSIGNED_SHORT";		break;
	case GL_INT:			t = "GL_INT";					break;
	case GL_UNSIGNED_INT:	t = "GL_UNSIGNED_INT";			break;
	case GL_FLOAT:			t = "GL_FLOAT";					break;
	case GL_DOUBLE:			t = "GL_DOUBLE";				break;
	default:				t = Str_VarArgs("0x%X", type);	break;
	}

	fprintf(qglState.logFile, "glNormalPointer( %s, %i, %p )\n", t, stride, pointer);
	dllNormalPointer(type, stride, pointer);
}

static GLvoid APIENTRY logOrtho (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar){

	fprintf(qglState.logFile, "glOrtho( %g, %g, %g, %g, %g, %g )\n", left, right, bottom, top, zNear, zFar);
	dllOrtho(left, right, bottom, top, zNear, zFar);
}

static GLvoid APIENTRY logPassThrough (GLfloat token){

	fprintf(qglState.logFile, "glPassThrough( %g )\n", token);
	dllPassThrough(token);
}

static GLvoid APIENTRY logPixelMapfv (GLenum map, GLsizei mapsize, const GLfloat *values){

	fprintf(qglState.logFile, "glPixelMapfv( 0x%X, %i, %p )\n", map, mapsize, values);
	dllPixelMapfv(map, mapsize, values);
}

static GLvoid APIENTRY logPixelMapuiv (GLenum map, GLsizei mapsize, const GLuint *values){

	fprintf(qglState.logFile, "glPixelMapuiv( 0x%X, %i, %p )\n", map, mapsize, values);
	dllPixelMapuiv(map, mapsize, values);
}

static GLvoid APIENTRY logPixelMapusv (GLenum map, GLsizei mapsize, const GLushort *values){

	fprintf(qglState.logFile, "glPixelMapusv( 0x%X, %i, %p )\n", map, mapsize, values);
	dllPixelMapusv(map, mapsize, values);
}

static GLvoid APIENTRY logPixelStoref (GLenum pname, GLfloat param){

	fprintf(qglState.logFile, "glPixelStoref( 0x%X, %g )\n", pname, param);
	dllPixelStoref(pname, param);
}

static GLvoid APIENTRY logPixelStorei (GLenum pname, GLint param){

	fprintf(qglState.logFile, "glPixelStorei( 0x%X, %i )\n", pname, param);
	dllPixelStorei(pname, param);
}

static GLvoid APIENTRY logPixelTransferf (GLenum pname, GLfloat param){

	fprintf(qglState.logFile, "glPixelTransferf( 0x%X, %g )\n", pname, param);
	dllPixelTransferf(pname, param);
}

static GLvoid APIENTRY logPixelTransferi (GLenum pname, GLint param){

	fprintf(qglState.logFile, "glPixelTransferi( 0x%X, %i )\n", pname, param);
	dllPixelTransferi(pname, param);
}

static GLvoid APIENTRY logPixelZoom (GLfloat xfactor, GLfloat yfactor){

	fprintf(qglState.logFile, "glPixelZoom( %g, %g )\n", xfactor, yfactor);
	dllPixelZoom(xfactor, yfactor);
}

static GLvoid APIENTRY logPointSize (GLfloat size){

	fprintf(qglState.logFile, "glPointSize( %g )\n", size);
	dllPointSize(size);
}

static GLvoid APIENTRY logPolygonMode (GLenum face, GLenum mode){

	const char	*f, *m;

	switch (face){
	case GL_FRONT:			f = "GL_FRONT";					break;
	case GL_BACK:			f = "GL_BACK";					break;
	case GL_FRONT_AND_BACK:	f = "GL_FRONT_AND_BACK";		break;
	default:				f = Str_VarArgs("0x%X", face);	break;
	}

	switch (mode){
	case GL_POINT:			m = "GL_POINT";					break;
	case GL_LINE:			m = "GL_LINE";					break;
	case GL_FILL:			m = "GL_FILL";					break;
	default:				m = Str_VarArgs("0x%X", mode);	break;
	}

	fprintf(qglState.logFile, "glPolygonMode( %s, %s )\n", f, m);
	dllPolygonMode(face, mode);
}

static GLvoid APIENTRY logPolygonOffset (GLfloat factor, GLfloat units){

	fprintf(qglState.logFile, "glPolygonOffset( %g, %g )\n", factor, units);
	dllPolygonOffset(factor, units);
}

static GLvoid APIENTRY logPolygonStipple (const GLubyte *mask){

	fprintf(qglState.logFile, "glPolygonStipple( %p )\n", mask);
	dllPolygonStipple(mask);
}

static GLvoid APIENTRY logPopAttrib (GLvoid){

	fprintf(qglState.logFile, "glPopAttrib()\n");
	dllPopAttrib();
}

static GLvoid APIENTRY logPopClientAttrib (GLvoid){

	fprintf(qglState.logFile, "glPopClientAttrib()\n");
	dllPopClientAttrib();
}

static GLvoid APIENTRY logPopMatrix (GLvoid){

	fprintf(qglState.logFile, "glPopMatrix()\n");
	dllPopMatrix();
}

static GLvoid APIENTRY logPopName (GLvoid){

	fprintf(qglState.logFile, "glPopName()\n");
	dllPopName();
}

static GLvoid APIENTRY logPrioritizeTextures (GLsizei n, const GLuint *textures, const GLclampf *priorities){

	fprintf(qglState.logFile, "glPrioritizeTextures( %i, %p, %p )\n", n, textures, priorities);
	dllPrioritizeTextures(n, textures, priorities);
}

static GLvoid APIENTRY logPushAttrib (GLbitfield mask){

	fprintf(qglState.logFile, "glPushAttrib( %u )\n", mask);
	dllPushAttrib(mask);
}

static GLvoid APIENTRY logPushClientAttrib (GLbitfield mask){

	fprintf(qglState.logFile, "glPushClientAttrib( %u )\n", mask);
	dllPushClientAttrib(mask);
}

static GLvoid APIENTRY logPushMatrix (GLvoid){

	fprintf(qglState.logFile, "glPushMatrix()\n");
	dllPushMatrix();
}

static GLvoid APIENTRY logPushName (GLuint name){

	fprintf(qglState.logFile, "glPushName( %u )\n", name);
	dllPushName(name);
}

static GLvoid APIENTRY logRasterPos2d (GLdouble x, GLdouble y){

	fprintf(qglState.logFile, "glRasterPot2d( %g, %g )\n", x, y);
	dllRasterPos2d(x, y);
}

static GLvoid APIENTRY logRasterPos2dv (const GLdouble *v){

	fprintf(qglState.logFile, "glRasterPos2dv( %p )\n", v);
	dllRasterPos2dv(v);
}

static GLvoid APIENTRY logRasterPos2f (GLfloat x, GLfloat y){

	fprintf(qglState.logFile, "glRasterPos2f( %g, %g )\n", x, y);
	dllRasterPos2f(x, y);
}

static GLvoid APIENTRY logRasterPos2fv (const GLfloat *v){

	fprintf(qglState.logFile, "glRasterPos2dv( %p )\n", v);
	dllRasterPos2fv(v);
}

static GLvoid APIENTRY logRasterPos2i (GLint x, GLint y){

	fprintf(qglState.logFile, "glRasterPos2if( %i, %i )\n", x, y);
	dllRasterPos2i(x, y);
}

static GLvoid APIENTRY logRasterPos2iv (const GLint *v){

	fprintf(qglState.logFile, "glRasterPos2iv( %p )\n", v);
	dllRasterPos2iv(v);
}

static GLvoid APIENTRY logRasterPos2s (GLshort x, GLshort y){

	fprintf(qglState.logFile, "glRasterPos2s( %i, %i )\n", x, y);
	dllRasterPos2s(x, y);
}

static GLvoid APIENTRY logRasterPos2sv (const GLshort *v){

	fprintf(qglState.logFile, "glRasterPos2sv( %p )\n", v);
	dllRasterPos2sv(v);
}

static GLvoid APIENTRY logRasterPos3d (GLdouble x, GLdouble y, GLdouble z){

	fprintf(qglState.logFile, "glRasterPos3d( %g, %g, %g )\n", x, y, z);
	dllRasterPos3d(x, y, z);
}

static GLvoid APIENTRY logRasterPos3dv (const GLdouble *v){

	fprintf(qglState.logFile, "glRasterPos3dv( %p )\n", v);
	dllRasterPos3dv(v);
}

static GLvoid APIENTRY logRasterPos3f (GLfloat x, GLfloat y, GLfloat z){

	fprintf(qglState.logFile, "glRasterPos3f( %g, %g, %g )\n", x, y, z);
	dllRasterPos3f(x, y, z);
}

static GLvoid APIENTRY logRasterPos3fv (const GLfloat *v){

	fprintf(qglState.logFile, "glRasterPos3fv( %p )\n", v);
	dllRasterPos3fv(v);
}

static GLvoid APIENTRY logRasterPos3i (GLint x, GLint y, GLint z){

	fprintf(qglState.logFile, "glRasterPos3i( %i, %i, %i )\n", x, y, z);
	dllRasterPos3i(x, y, z);
}

static GLvoid APIENTRY logRasterPos3iv (const GLint *v){

	fprintf(qglState.logFile, "glRasterPos3iv( %p )\n", v);
	dllRasterPos3iv(v);
}

static GLvoid APIENTRY logRasterPos3s (GLshort x, GLshort y, GLshort z){

	fprintf(qglState.logFile, "glRasterPos3s( %i, %i, %i )\n", x, y, z);
	dllRasterPos3s(x, y, z);
}

static GLvoid APIENTRY logRasterPos3sv (const GLshort *v){

	fprintf(qglState.logFile, "glRasterPos3sv( %p )\n", v);
	dllRasterPos3sv(v);
}

static GLvoid APIENTRY logRasterPos4d (GLdouble x, GLdouble y, GLdouble z, GLdouble w){

	fprintf(qglState.logFile, "glRasterPos4d( %g, %g, %g, %g )\n", x, y, z, w);
	dllRasterPos4d(x, y, z, w);
}

static GLvoid APIENTRY logRasterPos4dv (const GLdouble *v){

	fprintf(qglState.logFile, "glRasterPos4dv( %p )\n", v);
	dllRasterPos4dv(v);
}

static GLvoid APIENTRY logRasterPos4f (GLfloat x, GLfloat y, GLfloat z, GLfloat w){

	fprintf(qglState.logFile, "glRasterPos4f( %g, %g, %g, %g )\n", x, y, z, w);
	dllRasterPos4f(x, y, z, w);
}

static GLvoid APIENTRY logRasterPos4fv (const GLfloat *v){

	fprintf(qglState.logFile, "glRasterPos4fv( %p )\n", v);
	dllRasterPos4fv(v);
}

static GLvoid APIENTRY logRasterPos4i (GLint x, GLint y, GLint z, GLint w){

	fprintf(qglState.logFile, "glRasterPos4i( %i, %i, %i, %i )\n", x, y, z, w);
	dllRasterPos4i(x, y, z, w);
}

static GLvoid APIENTRY logRasterPos4iv (const GLint *v){

	fprintf(qglState.logFile, "glRasterPos4iv( %p )\n", v);
	dllRasterPos4iv(v);
}

static GLvoid APIENTRY logRasterPos4s (GLshort x, GLshort y, GLshort z, GLshort w){

	fprintf(qglState.logFile, "glRasterPos4s( %i, %i, %i, %i )\n", x, y, z, w);
	dllRasterPos4s(x, y, z, w);
}

static GLvoid APIENTRY logRasterPos4sv (const GLshort *v){

	fprintf(qglState.logFile, "glRasterPos4sv( %p )\n", v);
	dllRasterPos4sv(v);
}

static GLvoid APIENTRY logReadBuffer (GLenum mode){

	const char	*m;

	switch (mode){
	case GL_FRONT_LEFT:		m = "GL_FRONT_LEFT";			break;
	case GL_FRONT_RIGHT:	m = "GL_FRONT_RIGHT";			break;
	case GL_BACK_LEFT:		m = "GL_BACK_LEFT";				break;
	case GL_BACK_RIGHT:		m = "GL_BACK_RIGHT";			break;
	case GL_FRONT:			m = "GL_FRONT";					break;
	case GL_BACK:			m = "GL_BACK";					break;
	case GL_LEFT:			m = "GL_LEFT";					break;
	case GL_RIGHT:			m = "GL_RIGHT";					break;
	default:				m = Str_VarArgs("0x%X", mode);	break;
	}

	fprintf(qglState.logFile, "glReadBuffer( %s )\n", m);
	dllReadBuffer(mode);
}

static GLvoid APIENTRY logReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels){

	fprintf(qglState.logFile, "glReadPixels( %i, %i, %i, %i, 0x%X, 0x%X, %p )\n", x, y, width, height, format, type, pixels);
	dllReadPixels(x, y, width, height, format, type, pixels);
}

static GLvoid APIENTRY logRectd (GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2){

	fprintf(qglState.logFile, "glRectd( %g, %g, %g, %g )\n", x1, y1, x2, y2);
	dllRectd(x1, y1, x2, y2);
}

static GLvoid APIENTRY logRectdv (const GLdouble *v1, const GLdouble *v2){

	fprintf(qglState.logFile, "glRectdv( %p, %p )\n", v1, v2);
	dllRectdv(v1, v2);
}

static GLvoid APIENTRY logRectf (GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2){

	fprintf(qglState.logFile, "glRectf( %g, %g, %g, %g )\n", x1, y1, x2, y2);
	dllRectf(x1, y1, x2, y2);
}

static GLvoid APIENTRY logRectfv (const GLfloat *v1, const GLfloat *v2){

	fprintf(qglState.logFile, "glRectfv( %p, %p )\n", v1, v2);
	dllRectfv(v1, v2);
}

static GLvoid APIENTRY logRecti (GLint x1, GLint y1, GLint x2, GLint y2){

	fprintf(qglState.logFile, "glRecti( %i, %i, %i, %i )\n", x1, y1, x2, y2);
	dllRecti(x1, y1, x2, y2);
}

static GLvoid APIENTRY logRectiv (const GLint *v1, const GLint *v2){

	fprintf(qglState.logFile, "glRectiv( %p, %p )\n", v1, v2);
	dllRectiv(v1, v2);
}

static GLvoid APIENTRY logRects (GLshort x1, GLshort y1, GLshort x2, GLshort y2){

	fprintf(qglState.logFile, "glRects( %i, %i, %i, %i )\n", x1, y1, x2, y2);
	dllRects(x1, y1, x2, y2);
}

static GLvoid APIENTRY logRectsv (const GLshort *v1, const GLshort *v2){

	fprintf(qglState.logFile, "glRectsv( %p, %p )\n", v1, v2);
	dllRectsv(v1, v2);
}

static GLint APIENTRY logRenderMode (GLenum mode){

	fprintf(qglState.logFile, "glRenderMode( 0x%X )\n", mode);
	return dllRenderMode(mode);
}

static GLvoid APIENTRY logRotated (GLdouble angle, GLdouble x, GLdouble y, GLdouble z){

	fprintf(qglState.logFile, "glRotated( %g, %g, %g, %g )\n", angle, x, y, z);
	dllRotated(angle, x, y, z);
}

static GLvoid APIENTRY logRotatef (GLfloat angle, GLfloat x, GLfloat y, GLfloat z){

	fprintf(qglState.logFile, "glRotatef( %g, %g, %g, %g )\n", angle, x, y, z);
	dllRotatef(angle, x, y, z);
}

static GLvoid APIENTRY logScaled (GLdouble x, GLdouble y, GLdouble z){

	fprintf(qglState.logFile, "glScaled( %g, %g, %g )\n", x, y, z);
	dllScaled(x, y, z);
}

static GLvoid APIENTRY logScalef (GLfloat x, GLfloat y, GLfloat z){

	fprintf(qglState.logFile, "glScalef( %g, %g, %g )\n", x, y, z);
	dllScalef(x, y, z);
}

static GLvoid APIENTRY logScissor (GLint x, GLint y, GLsizei width, GLsizei height){

	fprintf(qglState.logFile, "glScissor( %i, %i, %i, %i )\n", x, y, width, height);
	dllScissor(x, y, width, height);
}

static GLvoid APIENTRY logSelectBuffer (GLsizei size, GLuint *buffer){

	fprintf(qglState.logFile, "glSelectBuffer( %i, %p )\n", size, buffer);
	dllSelectBuffer(size, buffer);
}

static GLvoid APIENTRY logShadeModel (GLenum mode){

	const char	*m;

	switch (mode){
	case GL_FLAT:	m = "GL_FLAT";					break;
	case GL_SMOOTH:	m = "GL_SMOOTH";				break;
	default:		m = Str_VarArgs("0x%X", mode);	break;
	}

	fprintf(qglState.logFile, "glShadeModel( %s )\n", m);
	dllShadeModel(mode);
}

static GLvoid APIENTRY logStencilFunc (GLenum func, GLint ref, GLuint mask){

	const char	*f;

	switch (func){
	case GL_NEVER:		f = "GL_NEVER";					break;
	case GL_LESS:		f = "GL_LESS";					break;
	case GL_LEQUAL:		f = "GL_LEQUAL";				break;
	case GL_GREATER:	f = "GL_GREATER";				break;
	case GL_GEQUAL:		f = "GL_GEQUAL";				break;
	case GL_EQUAL:		f = "GL_EQUAL";					break;
	case GL_NOTEQUAL:	f = "GL_NOTEQUAL";				break;
	case GL_ALWAYS:		f = "GL_ALWAYS";				break;
	default:			f = Str_VarArgs("0x%X", func);	break;
	}

	fprintf(qglState.logFile, "glStencilFunc( %s, %i, %u )\n", f, ref, mask);
	dllStencilFunc(func, ref, mask);
}

static GLvoid APIENTRY logStencilMask (GLuint mask){

	fprintf(qglState.logFile, "glStencilMask( %u )\n", mask);
	dllStencilMask(mask);
}

static GLvoid APIENTRY logStencilOp (GLenum fail, GLenum zfail, GLenum zpass){

	const char	*f, *zf, *zp;

	switch (fail){
	case GL_KEEP:		f = "GL_KEEP";						break;
	case GL_ZERO:		f = "GL_ZERO";						break;
	case GL_REPLACE:	f = "GL_REPLACE";					break;
	case GL_INCR:		f = "GL_INCR";						break;
	case GL_INCR_WRAP:	f = "GL_INCR_WRAP";					break;
	case GL_DECR:		f = "GL_DECR";						break;
	case GL_DECR_WRAP:	f = "GL_DECR_WRAP";					break;
	case GL_INVERT:		f = "GL_INVERT";					break;
	default:			f = Str_VarArgs("0x%X", fail);		break;
	}

	switch (zfail){
	case GL_KEEP:		zf = "GL_KEEP";						break;
	case GL_ZERO:		zf = "GL_ZERO";						break;
	case GL_REPLACE:	zf = "GL_REPLACE";					break;
	case GL_INCR:		zf = "GL_INCR";						break;
	case GL_INCR_WRAP:	zf = "GL_INCR_WRAP";				break;
	case GL_DECR:		zf = "GL_DECR";						break;
	case GL_DECR_WRAP:	zf = "GL_DECR_WRAP";				break;
	case GL_INVERT:		zf = "GL_INVERT";					break;
	default:			zf = Str_VarArgs("0x%X", zfail);	break;
	}

	switch (zpass){
	case GL_KEEP:		zp = "GL_KEEP";						break;
	case GL_ZERO:		zp = "GL_ZERO";						break;
	case GL_REPLACE:	zp = "GL_REPLACE";					break;
	case GL_INCR:		zp = "GL_INCR";						break;
	case GL_INCR_WRAP:	zp = "GL_INCR_WRAP";				break;
	case GL_DECR:		zp = "GL_DECR";						break;
	case GL_DECR_WRAP:	zp = "GL_DECR_WRAP";				break;
	case GL_INVERT:		zp = "GL_INVERT";					break;
	default:			zp = Str_VarArgs("0x%X", zpass);	break;
	}

	fprintf(qglState.logFile, "glStencilOp( %s, %s, %s )\n", f, zf, zp);
	dllStencilOp(fail, zfail, zpass);
}

static GLvoid APIENTRY logTexCoord1d (GLdouble s){

	fprintf(qglState.logFile, "glTexCoord1d( %g )\n", s);
	dllTexCoord1d(s);
}

static GLvoid APIENTRY logTexCoord1dv (const GLdouble *v){

	fprintf(qglState.logFile, "glTexCoord1dv( %p )\n", v);
	dllTexCoord1dv(v);
}

static GLvoid APIENTRY logTexCoord1f (GLfloat s){

	fprintf(qglState.logFile, "glTexCoord1f( %g )\n", s);
	dllTexCoord1f(s);
}

static GLvoid APIENTRY logTexCoord1fv (const GLfloat *v){

	fprintf(qglState.logFile, "glTexCoord1fv( %p )\n", v);
	dllTexCoord1fv(v);
}

static GLvoid APIENTRY logTexCoord1i (GLint s){

	fprintf(qglState.logFile, "glTexCoord1i( %i )\n", s);
	dllTexCoord1i(s);
}

static GLvoid APIENTRY logTexCoord1iv (const GLint *v){

	fprintf(qglState.logFile, "glTexCoord1iv( %p )\n", v);
	dllTexCoord1iv(v);
}

static GLvoid APIENTRY logTexCoord1s (GLshort s){

	fprintf(qglState.logFile, "glTexCoord1s( %i )\n", s);
	dllTexCoord1s(s);
}

static GLvoid APIENTRY logTexCoord1sv (const GLshort *v){

	fprintf(qglState.logFile, "glTexCoord1sv( %p )\n", v);
	dllTexCoord1sv(v);
}

static GLvoid APIENTRY logTexCoord2d (GLdouble s, GLdouble t){

	fprintf(qglState.logFile, "glTexCoord2d( %g, %g )\n", s, t);
	dllTexCoord2d(s, t);
}

static GLvoid APIENTRY logTexCoord2dv (const GLdouble *v){

	fprintf(qglState.logFile, "glTexCoord2dv( %p )\n", v);
	dllTexCoord2dv(v);
}

static GLvoid APIENTRY logTexCoord2f (GLfloat s, GLfloat t){

	fprintf(qglState.logFile, "glTexCoord2f( %g, %g )\n", s, t);
	dllTexCoord2f(s, t);
}

static GLvoid APIENTRY logTexCoord2fv (const GLfloat *v){

	fprintf(qglState.logFile, "glTexCoord2fv( %p )\n", v);
	dllTexCoord2fv(v);
}

static GLvoid APIENTRY logTexCoord2i (GLint s, GLint t){

	fprintf(qglState.logFile, "glTexCoord2i( %i, %i )\n", s, t);
	dllTexCoord2i(s, t);
}

static GLvoid APIENTRY logTexCoord2iv (const GLint *v){

	fprintf(qglState.logFile, "glTexCoord2iv( %p )\n", v);
	dllTexCoord2iv(v);
}

static GLvoid APIENTRY logTexCoord2s (GLshort s, GLshort t){

	fprintf(qglState.logFile, "glTexCoord2s( %i, %i )\n", s, t);
	dllTexCoord2s(s, t);
}

static GLvoid APIENTRY logTexCoord2sv (const GLshort *v){

	fprintf(qglState.logFile, "glTexCoord2sv( %p )\n", v);
	dllTexCoord2sv(v);
}

static GLvoid APIENTRY logTexCoord3d (GLdouble s, GLdouble t, GLdouble r){

	fprintf(qglState.logFile, "glTexCoord3d( %g, %g, %g )\n", s, t, r);
	dllTexCoord3d(s, t, r);
}

static GLvoid APIENTRY logTexCoord3dv (const GLdouble *v){

	fprintf(qglState.logFile, "glTexCoord3dv( %p )\n", v);
	dllTexCoord3dv(v);
}

static GLvoid APIENTRY logTexCoord3f (GLfloat s, GLfloat t, GLfloat r){

	fprintf(qglState.logFile, "glTexCoord3f( %g, %g, %g )\n", s, t, r);
	dllTexCoord3f(s, t, r);
}

static GLvoid APIENTRY logTexCoord3fv (const GLfloat *v){

	fprintf(qglState.logFile, "glTexCoord3fv( %p )\n", v);
	dllTexCoord3fv(v);
}

static GLvoid APIENTRY logTexCoord3i (GLint s, GLint t, GLint r){

	fprintf(qglState.logFile, "glTexCoord3i( %i, %i, %i )\n", s, t, r);
	dllTexCoord3i(s, t, r);
}

static GLvoid APIENTRY logTexCoord3iv (const GLint *v){

	fprintf(qglState.logFile, "glTexCoord3iv( %p )\n");
	dllTexCoord3iv(v);
}

static GLvoid APIENTRY logTexCoord3s (GLshort s, GLshort t, GLshort r){

	fprintf(qglState.logFile, "glTexCoord3s( %i, %i, %i )\n", s, t, r);
	dllTexCoord3s(s, t, r);
}

static GLvoid APIENTRY logTexCoord3sv (const GLshort *v){

	fprintf(qglState.logFile, "glTexCoord3sv( %p )\n", v);
	dllTexCoord3sv(v);
}

static GLvoid APIENTRY logTexCoord4d (GLdouble s, GLdouble t, GLdouble r, GLdouble q){

	fprintf(qglState.logFile, "glTexCoord4d( %g, %g, %g, %g )\n", s, t, r, q);
	dllTexCoord4d(s, t, r, q);
}

static GLvoid APIENTRY logTexCoord4dv (const GLdouble *v){

	fprintf(qglState.logFile, "glTexCoord4dv( %p )\n", v);
	dllTexCoord4dv(v);
}

static GLvoid APIENTRY logTexCoord4f (GLfloat s, GLfloat t, GLfloat r, GLfloat q){

	fprintf(qglState.logFile, "glTexCoord4f( %g, %g, %g, %g )\n", s, t, r, q);
	dllTexCoord4f(s, t, r, q);
}

static GLvoid APIENTRY logTexCoord4fv (const GLfloat *v){

	fprintf(qglState.logFile, "glTexCoord4fv( %p )\n", v);
	dllTexCoord4fv(v);
}

static GLvoid APIENTRY logTexCoord4i (GLint s, GLint t, GLint r, GLint q){

	fprintf(qglState.logFile, "glTexCoord4i( %i, %i, %i, %i )\n", s, t, r, q);
	dllTexCoord4i(s, t, r, q);
}

static GLvoid APIENTRY logTexCoord4iv (const GLint *v){

	fprintf(qglState.logFile, "glTexCoord4iv( %p )\n", v);
	dllTexCoord4iv(v);
}

static GLvoid APIENTRY logTexCoord4s (GLshort s, GLshort t, GLshort r, GLshort q){

	fprintf(qglState.logFile, "glTexCoord4s( %i, %i, %i, %i )\n", s, t, r, q);
	dllTexCoord4s(s, t, r, q);
}

static GLvoid APIENTRY logTexCoord4sv (const GLshort *v){

	fprintf(qglState.logFile, "glTexCoord4sv( %p )\n", v);
	dllTexCoord4sv(v);
}

static GLvoid APIENTRY logTexCoordPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer){

	const char	*t;

	switch (type){
	case GL_BYTE:			t = "GL_BYTE";					break;
	case GL_UNSIGNED_BYTE:	t = "GL_UNSIGNED_BYTE";			break;
	case GL_SHORT:			t = "GL_SHORT";					break;
	case GL_UNSIGNED_SHORT:	t = "GL_UNSIGNED_SHORT";		break;
	case GL_INT:			t = "GL_INT";					break;
	case GL_UNSIGNED_INT:	t = "GL_UNSIGNED_INT";			break;
	case GL_FLOAT:			t = "GL_FLOAT";					break;
	case GL_DOUBLE:			t = "GL_DOUBLE";				break;
	default:				t = Str_VarArgs("0x%X", type);	break;
	}

	fprintf(qglState.logFile, "glTexCoordPointer( %i, %s, %i, %p )\n", size, t, stride, pointer);
	dllTexCoordPointer(size, type, stride, pointer);
}

static GLvoid APIENTRY logTexEnvf (GLenum target, GLenum pname, GLfloat param){

	const char	*t, *n, *p;

	switch (target){
	case GL_TEXTURE_ENV:			t = "GL_TEXTURE_ENV";				break;
	default:						t = Str_VarArgs("0x%X", target);	break;
	}

	switch (pname){
	case GL_TEXTURE_ENV_MODE:		n = "GL_TEXTURE_ENV_MODE";			break;
	case GL_COMBINE_RGB:			n = "GL_COMBINE_RGB";				break;
	case GL_COMBINE_ALPHA:			n = "GL_COMBINE_ALPHA";				break;
	case GL_SRC0_RGB:				n = "GL_SRC0_RGB";					break;
	case GL_SRC1_RGB:				n = "GL_SRC1_RGB";					break;
	case GL_SRC2_RGB:				n = "GL_SRC2_RGB";					break;
	case GL_SRC0_ALPHA:				n = "GL_SRC0_ALPHA";				break;
	case GL_SRC1_ALPHA:				n = "GL_SRC1_ALPHA";				break;
	case GL_SRC2_ALPHA:				n = "GL_SRC2_ALPHA";				break;
	case GL_OPERAND0_RGB:			n = "GL_OPERAND0_RGB";				break;
	case GL_OPERAND1_RGB:			n = "GL_OPERAND1_RGB";				break;
	case GL_OPERAND2_RGB:			n = "GL_OPERAND2_RGB";				break;
	case GL_OPERAND0_ALPHA:			n = "GL_OPERAND0_ALPHA";			break;
	case GL_OPERAND1_ALPHA:			n = "GL_OPERAND1_ALPHA";			break;
	case GL_OPERAND2_ALPHA:			n = "GL_OPERAND2_ALPHA";			break;
	case GL_RGB_SCALE:				n = "GL_RGB_SCALE";					break;
	case GL_ALPHA_SCALE:			n = "GL_ALPHA_SCALE";				break;
	default:						n = Str_VarArgs("0x%X", pname);		break;
	}

	switch ((int)param){
	case GL_REPLACE:				p = "GL_REPLACE";					break;
	case GL_MODULATE:				p = "GL_MODULATE";					break;
	case GL_DECAL:					p = "GL_DECAL";						break;
	case GL_BLEND:					p = "GL_BLEND";						break;
	case GL_ADD:					p = "GL_ADD";						break;
	case GL_ADD_SIGNED:				p = "GL_ADD_SIGNED";				break;
	case GL_SUBTRACT:				p = "GL_SUBTRACT";					break;
	case GL_INTERPOLATE:			p = "GL_INTERPOLATE";				break;
	case GL_COMBINE:				p = "GL_COMBINE";					break;
	case GL_TEXTURE:				p = "GL_TEXTURE";					break;
	case GL_PREVIOUS:				p = "GL_PREVIOUS";					break;
	case GL_CONSTANT:				p = "GL_CONSTANT";					break;
	case GL_PRIMARY_COLOR:			p = "GL_PRIMARY_COLOR";				break;
	case GL_SRC_COLOR:				p = "GL_SRC_COLOR";					break;
	case GL_ONE_MINUS_SRC_COLOR:	p = "GL_ONE_MINUS_SRC_COLOR";		break;
	case GL_SRC_ALPHA:				p = "GL_SRC_ALPHA";					break;
	case GL_ONE_MINUS_SRC_ALPHA:	p = "GL_ONE_MINUS_SRC_ALPHA";		break;
	default:						p = Str_VarArgs("0x%X", param);		break;
	}

	if (pname == GL_RGB_SCALE || pname == GL_ALPHA_SCALE)
		p = Str_VarArgs("%g", param);

	fprintf(qglState.logFile, "glTexEnvf( %s, %s, %s )\n", t, n, p);
	dllTexEnvf(target, pname, param);
}

static GLvoid APIENTRY logTexEnvfv (GLenum target, GLenum pname, const GLfloat *params){

	const char	*t, *n;

	switch (target){
	case GL_TEXTURE_ENV:		t = "GL_TEXTURE_ENV";				break;
	default:					t = Str_VarArgs("0x%X", target);	break;
	}

	switch (pname){
	case GL_TEXTURE_ENV_MODE:	n = "GL_TEXTURE_ENV_MODE";			break;
	case GL_TEXTURE_ENV_COLOR:	n = "GL_TEXTURE_ENV_COLOR";			break;
	case GL_COMBINE_RGB:		n = "GL_COMBINE_RGB";				break;
	case GL_COMBINE_ALPHA:		n = "GL_COMBINE_ALPHA";				break;
	case GL_SRC0_RGB:			n = "GL_SRC0_RGB";					break;
	case GL_SRC1_RGB:			n = "GL_SRC1_RGB";					break;
	case GL_SRC2_RGB:			n = "GL_SRC2_RGB";					break;
	case GL_SRC0_ALPHA:			n = "GL_SRC0_ALPHA";				break;
	case GL_SRC1_ALPHA:			n = "GL_SRC1_ALPHA";				break;
	case GL_SRC2_ALPHA:			n = "GL_SRC2_ALPHA";				break;
	case GL_OPERAND0_RGB:		n = "GL_OPERAND0_RGB";				break;
	case GL_OPERAND1_RGB:		n = "GL_OPERAND1_RGB";				break;
	case GL_OPERAND2_RGB:		n = "GL_OPERAND2_RGB";				break;
	case GL_OPERAND0_ALPHA:		n = "GL_OPERAND0_ALPHA";			break;
	case GL_OPERAND1_ALPHA:		n = "GL_OPERAND1_ALPHA";			break;
	case GL_OPERAND2_ALPHA:		n = "GL_OPERAND2_ALPHA";			break;
	case GL_RGB_SCALE:			n = "GL_RGB_SCALE";					break;
	case GL_ALPHA_SCALE:		n = "GL_ALPHA_SCALE";				break;
	default:					n = Str_VarArgs("0x%X", pname);		break;
	}

	fprintf(qglState.logFile, "glTexEnvfv( %s, %s, %p )\n", t, n, params);
	dllTexEnvfv(target, pname, params);
}

static GLvoid APIENTRY logTexEnvi (GLenum target, GLenum pname, GLint param){

	const char	*t, *n, *p;

	switch (target){
	case GL_TEXTURE_ENV:			t = "GL_TEXTURE_ENV";				break;
	default:						t = Str_VarArgs("0x%X", target);	break;
	}

	switch (pname){
	case GL_TEXTURE_ENV_MODE:		n = "GL_TEXTURE_ENV_MODE";			break;
	case GL_COMBINE_RGB:			n = "GL_COMBINE_RGB";				break;
	case GL_COMBINE_ALPHA:			n = "GL_COMBINE_ALPHA";				break;
	case GL_SRC0_RGB:				n = "GL_SRC0_RGB";					break;
	case GL_SRC1_RGB:				n = "GL_SRC1_RGB";					break;
	case GL_SRC2_RGB:				n = "GL_SRC2_RGB";					break;
	case GL_SRC0_ALPHA:				n = "GL_SRC0_ALPHA";				break;
	case GL_SRC1_ALPHA:				n = "GL_SRC1_ALPHA";				break;
	case GL_SRC2_ALPHA:				n = "GL_SRC2_ALPHA";				break;
	case GL_OPERAND0_RGB:			n = "GL_OPERAND0_RGB";				break;
	case GL_OPERAND1_RGB:			n = "GL_OPERAND1_RGB";				break;
	case GL_OPERAND2_RGB:			n = "GL_OPERAND2_RGB";				break;
	case GL_OPERAND0_ALPHA:			n = "GL_OPERAND0_ALPHA";			break;
	case GL_OPERAND1_ALPHA:			n = "GL_OPERAND1_ALPHA";			break;
	case GL_OPERAND2_ALPHA:			n = "GL_OPERAND2_ALPHA";			break;
	case GL_RGB_SCALE:				n = "GL_RGB_SCALE";					break;
	case GL_ALPHA_SCALE:			n = "GL_ALPHA_SCALE";				break;
	default:						n = Str_VarArgs("0x%X", pname);		break;
	}

	switch (param){
	case GL_REPLACE:				p = "GL_REPLACE";					break;
	case GL_MODULATE:				p = "GL_MODULATE";					break;
	case GL_DECAL:					p = "GL_DECAL";						break;
	case GL_BLEND:					p = "GL_BLEND";						break;
	case GL_ADD:					p = "GL_ADD";						break;
	case GL_ADD_SIGNED:				p = "GL_ADD_SIGNED";				break;
	case GL_SUBTRACT:				p = "GL_SUBTRACT";					break;
	case GL_INTERPOLATE:			p = "GL_INTERPOLATE";				break;
	case GL_COMBINE:				p = "GL_COMBINE";					break;
	case GL_TEXTURE:				p = "GL_TEXTURE";					break;
	case GL_PREVIOUS:				p = "GL_PREVIOUS";					break;
	case GL_CONSTANT:				p = "GL_CONSTANT";					break;
	case GL_PRIMARY_COLOR:			p = "GL_PRIMARY_COLOR";				break;
	case GL_SRC_COLOR:				p = "GL_SRC_COLOR";					break;
	case GL_ONE_MINUS_SRC_COLOR:	p = "GL_ONE_MINUS_SRC_COLOR";		break;
	case GL_SRC_ALPHA:				p = "GL_SRC_ALPHA";					break;
	case GL_ONE_MINUS_SRC_ALPHA:	p = "GL_ONE_MINUS_SRC_ALPHA";		break;
	default:						p = Str_VarArgs("0x%X", param);		break;
	}

	if (pname == GL_RGB_SCALE || pname == GL_ALPHA_SCALE)
		p = Str_VarArgs("%i", param);

	fprintf(qglState.logFile, "glTexEnvi( %s, %s, %s )\n", t, n, p);
	dllTexEnvi(target, pname, param);
}

static GLvoid APIENTRY logTexEnviv (GLenum target, GLenum pname, const GLint *params){

	const char	*t, *n;

	switch (target){
	case GL_TEXTURE_ENV:		t = "GL_TEXTURE_ENV";				break;
	default:					t = Str_VarArgs("0x%X", target);	break;
	}

	switch (pname){
	case GL_TEXTURE_ENV_MODE:	n = "GL_TEXTURE_ENV_MODE";			break;
	case GL_TEXTURE_ENV_COLOR:	n = "GL_TEXTURE_ENV_COLOR";			break;
	case GL_COMBINE_RGB:		n = "GL_COMBINE_RGB";				break;
	case GL_COMBINE_ALPHA:		n = "GL_COMBINE_ALPHA";				break;
	case GL_SRC0_RGB:			n = "GL_SRC0_RGB";					break;
	case GL_SRC1_RGB:			n = "GL_SRC1_RGB";					break;
	case GL_SRC2_RGB:			n = "GL_SRC2_RGB";					break;
	case GL_SRC0_ALPHA:			n = "GL_SRC0_ALPHA";				break;
	case GL_SRC1_ALPHA:			n = "GL_SRC1_ALPHA";				break;
	case GL_SRC2_ALPHA:			n = "GL_SRC2_ALPHA";				break;
	case GL_OPERAND0_RGB:		n = "GL_OPERAND0_RGB";				break;
	case GL_OPERAND1_RGB:		n = "GL_OPERAND1_RGB";				break;
	case GL_OPERAND2_RGB:		n = "GL_OPERAND2_RGB";				break;
	case GL_OPERAND0_ALPHA:		n = "GL_OPERAND0_ALPHA";			break;
	case GL_OPERAND1_ALPHA:		n = "GL_OPERAND1_ALPHA";			break;
	case GL_OPERAND2_ALPHA:		n = "GL_OPERAND2_ALPHA";			break;
	case GL_RGB_SCALE:			n = "GL_RGB_SCALE";					break;
	case GL_ALPHA_SCALE:		n = "GL_ALPHA_SCALE";				break;
	default:					n = Str_VarArgs("0x%X", pname);		break;
	}

	fprintf(qglState.logFile, "glTexEnviv( %s, %s, %p )\n", t, n, params);
	dllTexEnviv(target, pname, params);
}

static GLvoid APIENTRY logTexGend (GLenum coord, GLenum pname, GLdouble param){

	const char	*c, *n, *p;

	switch (coord){
	case GL_S:					c = "GL_S";						break;
	case GL_T:					c = "GL_T";						break;
	case GL_R:					c = "GL_R";						break;
	case GL_Q:					c = "GL_Q";						break;
	default:					c = Str_VarArgs("0x%X", coord);	break;
	}

	switch (pname){
	case GL_TEXTURE_GEN_MODE:	n = "GL_TEXTURE_GEN_MODE";		break;
	default:					n = Str_VarArgs("0x%X", pname);	break;
	}

	switch ((int)param){
	case GL_OBJECT_LINEAR:		p = "GL_OBJECT_LINEAR";			break;
	case GL_EYE_LINEAR:			p = "GL_EYE_LINEAR";			break;
	case GL_SPHERE_MAP:			p = "GL_SPHERE_MAP";			break;
	case GL_REFLECTION_MAP:		p = "GL_REFLECTION_MAP";		break;
	case GL_NORMAL_MAP:			p = "GL_NORMAL_MAP";			break;
	default:					p = Str_VarArgs("0x%X", param);	break;
	}

	fprintf(qglState.logFile, "glTexGend( %s, %s, %s )\n", c, n, p);
	dllTexGend(coord, pname, param);
}

static GLvoid APIENTRY logTexGendv (GLenum coord, GLenum pname, const GLdouble *params){

	const char	*c, *n;

	switch (coord){
	case GL_S:					c = "GL_S";						break;
	case GL_T:					c = "GL_T";						break;
	case GL_R:					c = "GL_R";						break;
	case GL_Q:					c = "GL_Q";						break;
	default:					c = Str_VarArgs("0x%X", coord);	break;
	}

	switch (pname){
	case GL_TEXTURE_GEN_MODE:	n = "GL_TEXTURE_GEN_MODE";		break;
	case GL_OBJECT_PLANE:		n = "GL_OBJECT_PLANE";			break;
	case GL_EYE_PLANE:			n = "GL_EYE_PLANE";				break;
	default:					n = Str_VarArgs("0x%X", pname);	break;
	}

	fprintf(qglState.logFile, "glTexGendv( %s, %s, %p )\n", c, n, params);
	dllTexGendv(coord, pname, params);
}

static GLvoid APIENTRY logTexGenf (GLenum coord, GLenum pname, GLfloat param){

	const char	*c, *n, *p;

	switch (coord){
	case GL_S:					c = "GL_S";						break;
	case GL_T:					c = "GL_T";						break;
	case GL_R:					c = "GL_R";						break;
	case GL_Q:					c = "GL_Q";						break;
	default:					c = Str_VarArgs("0x%X", coord);	break;
	}

	switch (pname){
	case GL_TEXTURE_GEN_MODE:	n = "GL_TEXTURE_GEN_MODE";		break;
	default:					n = Str_VarArgs("0x%X", pname);	break;
	}

	switch ((int)param){
	case GL_OBJECT_LINEAR:		p = "GL_OBJECT_LINEAR";			break;
	case GL_EYE_LINEAR:			p = "GL_EYE_LINEAR";			break;
	case GL_SPHERE_MAP:			p = "GL_SPHERE_MAP";			break;
	case GL_REFLECTION_MAP:		p = "GL_REFLECTION_MAP";		break;
	case GL_NORMAL_MAP:			p = "GL_NORMAL_MAP";			break;
	default:					p = Str_VarArgs("0x%X", param);	break;
	}

	fprintf(qglState.logFile, "glTexGenf( %s, %s, %s )\n", c, n, p);
	dllTexGenf(coord, pname, param);
}

static GLvoid APIENTRY logTexGenfv (GLenum coord, GLenum pname, const GLfloat *params){

	const char	*c, *n;

	switch (coord){
	case GL_S:					c = "GL_S";						break;
	case GL_T:					c = "GL_T";						break;
	case GL_R:					c = "GL_R";						break;
	case GL_Q:					c = "GL_Q";						break;
	default:					c = Str_VarArgs("0x%X", coord);	break;
	}

	switch (pname){
	case GL_TEXTURE_GEN_MODE:	n = "GL_TEXTURE_GEN_MODE";		break;
	case GL_OBJECT_PLANE:		n = "GL_OBJECT_PLANE";			break;
	case GL_EYE_PLANE:			n = "GL_EYE_PLANE";				break;
	default:					n = Str_VarArgs("0x%X", pname);	break;
	}

	fprintf(qglState.logFile, "glTexGenfv( %s, %s, %p )\n", c, n, params);
	dllTexGenfv(coord, pname, params);
}

static GLvoid APIENTRY logTexGeni (GLenum coord, GLenum pname, GLint param){

	const char	*c, *n, *p;

	switch (coord){
	case GL_S:					c = "GL_S";						break;
	case GL_T:					c = "GL_T";						break;
	case GL_R:					c = "GL_R";						break;
	case GL_Q:					c = "GL_Q";						break;
	default:					c = Str_VarArgs("0x%X", coord);	break;
	}

	switch (pname){
	case GL_TEXTURE_GEN_MODE:	n = "GL_TEXTURE_GEN_MODE";		break;
	default:					n = Str_VarArgs("0x%X", pname);	break;
	}

	switch (param){
	case GL_OBJECT_LINEAR:		p = "GL_OBJECT_LINEAR";			break;
	case GL_EYE_LINEAR:			p = "GL_EYE_LINEAR";			break;
	case GL_SPHERE_MAP:			p = "GL_SPHERE_MAP";			break;
	case GL_REFLECTION_MAP:		p = "GL_REFLECTION_MAP";		break;
	case GL_NORMAL_MAP:			p = "GL_NORMAL_MAP";			break;
	default:					p = Str_VarArgs("0x%X", param);	break;
	}

	fprintf(qglState.logFile, "glTexGeni( %s, %s, %s )\n", c, n, p);
	dllTexGeni(coord, pname, param);
}

static GLvoid APIENTRY logTexGeniv (GLenum coord, GLenum pname, const GLint *params){

	const char	*c, *n;

	switch (coord){
	case GL_S:					c = "GL_S";						break;
	case GL_T:					c = "GL_T";						break;
	case GL_R:					c = "GL_R";						break;
	case GL_Q:					c = "GL_Q";						break;
	default:					c = Str_VarArgs("0x%X", coord);	break;
	}

	switch (pname){
	case GL_TEXTURE_GEN_MODE:	n = "GL_TEXTURE_GEN_MODE";		break;
	case GL_OBJECT_PLANE:		n = "GL_OBJECT_PLANE";			break;
	case GL_EYE_PLANE:			n = "GL_EYE_PLANE";				break;
	default:					n = Str_VarArgs("0x%X", pname);	break;
	}

	fprintf(qglState.logFile, "glTexGeniv( %s, %s, %p )\n", c, n, params);
	dllTexGeniv(coord, pname, params);
}

static GLvoid APIENTRY logTexImage1D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels){

	const char	*t, *i, *f, *t2;

	switch (target){
	case GL_TEXTURE_1D:					t = "GL_TEXTURE_1D";						break;
	default:							t = Str_VarArgs("0x%X", target);			break;
	}

	switch (internalformat){
	case GL_ALPHA:						i = "GL_ALPHA";								break;
	case GL_ALPHA4:						i = "GL_ALPHA4";							break;
	case GL_ALPHA8:						i = "GL_ALPHA8";							break;
	case GL_ALPHA12:					i = "GL_ALPHA12";							break;
	case GL_ALPHA16:					i = "GL_ALPHA16";							break;
	case GL_LUMINANCE:					i = "GL_LUMINANCE";							break;
	case GL_LUMINANCE4:					i = "GL_LUMINANCE4";						break;
	case GL_LUMINANCE8:					i = "GL_LUMINANCE8";						break;
	case GL_LUMINANCE12:				i = "GL_LUMINANCE12";						break;
	case GL_LUMINANCE16:				i = "GL_LUMINANCE16";						break;
	case GL_LUMINANCE_ALPHA:			i = "GL_LUMINANCE_ALPHA";					break;
	case GL_LUMINANCE4_ALPHA4:			i = "GL_LUMINANCE4_ALPHA4";					break;
	case GL_LUMINANCE6_ALPHA2:			i = "GL_LUMINANCE6_ALPHA2";					break;
	case GL_LUMINANCE8_ALPHA8:			i = "GL_LUMINANCE8_ALPHA8";					break;
	case GL_LUMINANCE12_ALPHA4:			i = "GL_LUMINANCE12_ALPHA4";				break;
	case GL_LUMINANCE12_ALPHA12:		i = "GL_LUMINANCE12_ALPHA12";				break;
	case GL_LUMINANCE16_ALPHA16:		i = "GL_LUMINANCE16_ALPHA16";				break;
	case GL_INTENSITY:					i = "GL_INTENSITY";							break;
	case GL_INTENSITY4:					i = "GL_INTENSITY4";						break;
	case GL_INTENSITY8:					i = "GL_INTENSITY8";						break;
	case GL_INTENSITY12:				i = "GL_INTENSITY12";						break;
	case GL_INTENSITY16:				i = "GL_INTENSITY16";						break;
	case GL_R3_G3_B2:					i = "GL_R3_G3_B2";							break;
	case GL_RGB:						i = "GL_RGB";								break;
	case GL_RGB4:						i = "GL_RGB4";								break;
	case GL_RGB5:						i = "GL_RGB5";								break;
	case GL_RGB8:						i = "GL_RGB8";								break;
	case GL_RGB10:						i = "GL_RGB10";								break;
	case GL_RGB12:						i = "GL_RGB12";								break;
	case GL_RGB16:						i = "GL_RGB16";								break;
	case GL_RGBA:						i = "GL_RGBA";								break;
	case GL_RGBA2:						i = "GL_RGBA2";								break;
	case GL_RGBA4:						i = "GL_RGBA4";								break;
	case GL_RGB5_A1:					i = "GL_RGB5_A1";							break;
	case GL_RGBA8:						i = "GL_RGBA8";								break;
	case GL_RGB10_A2:					i = "GL_RGB10_A2";							break;
	case GL_RGBA12:						i = "GL_RGBA12";							break;
	case GL_RGBA16:						i = "GL_RGBA16";							break;
	case GL_COMPRESSED_ALPHA:			i = "GL_COMPRESSED_ALPHA";					break;
	case GL_COMPRESSED_RGB:				i = "GL_COMPRESSED_RGB";					break;
	case GL_COMPRESSED_RGBA:			i = "GL_COMPRESSED_RGBA";					break;
	case GL_COMPRESSED_LUMINANCE:		i = "GL_COMPRESSED_LUMINANCE";				break;
	case GL_COMPRESSED_LUMINANCE_ALPHA:	i = "GL_COMPRESSED_LUMINANCE_ALPHA";		break;
	case GL_COMPRESSED_INTENSITY:		i = "GL_COMPRESSED_INTENSITY";				break;
	default:							i = Str_VarArgs("0x%X", internalformat);	break;
	}

	switch (format){
	case GL_COLOR_INDEX:				f = "GL_COLOR_INDEX";						break;
	case GL_RED:						f = "GL_RED";								break;
	case GL_GREEN:						f = "GL_GREEN";								break;
	case GL_BLUE:						f = "GL_BLUE";								break;
	case GL_ALPHA:						f = "GL_ALPHA";								break;
	case GL_RGB:						f = "GL_RGB";								break;
	case GL_RGBA:						f = "GL_RGBA";								break;
	case GL_BGR:						f = "GL_BGR";								break;
	case GL_BGRA:						f = "GL_BGRA";								break;
	case GL_LUMINANCE:					f = "GL_LUMINANCE";							break;
	case GL_LUMINANCE_ALPHA:			f = "GL_LUMINANCE_ALPHA";					break;
	default:							f = Str_VarArgs("0x%X", format);			break;
	}

	switch (type){
	case GL_BYTE:						t2 = "GL_BYTE";								break;
	case GL_UNSIGNED_BYTE:				t2 = "GL_UNSIGNED_BYTE";					break;
	case GL_BITMAP:						t2 = "GL_BITMAP";							break;
	case GL_SHORT:						t2 = "GL_SHORT";							break;
	case GL_UNSIGNED_SHORT:				t2 = "GL_UNSIGNED_SHORT";					break;
	case GL_INT:						t2 = "GL_INT";								break;
	case GL_UNSIGNED_INT:				t2 = "GL_UNSIGNED_INT";						break;
	case GL_FLOAT:						t2 = "GL_FLOAT";							break;
	default:							t2 = Str_VarArgs("0x%X", type);				break;
	}

	fprintf(qglState.logFile, "glTexImage1D( %s, %i, %s, %i, %i, %s, %s, %p )\n", t, level, i, width, border, f, t2, pixels);
	dllTexImage1D(target, level, internalformat, width, border, format, type, pixels);
}

static GLvoid APIENTRY logTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels){

	const char	*t, *i, *f, *t2;

	switch (target){
	case GL_TEXTURE_2D:						t = "GL_TEXTURE_2D";						break;
	case GL_TEXTURE_CUBE_MAP_POSITIVE_X:	t = "GL_TEXTURE_CUBE_MAP_POSITIVE_X";		break;
	case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:	t = "GL_TEXTURE_CUBE_MAP_POSITIVE_Y";		break;
	case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:	t = "GL_TEXTURE_CUBE_MAP_POSITIVE_Z";		break;
	case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:	t = "GL_TEXTURE_CUBE_MAP_NEGATIVE_X";		break;
	case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:	t = "GL_TEXTURE_CUBE_MAP_NEGATIVE_Y";		break;
	case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:	t = "GL_TEXTURE_CUBE_MAP_NEGATIVE_Z";		break;
	default:								t = Str_VarArgs("0x%X", target);			break;
	}

	switch (internalformat){
	case GL_ALPHA:							i = "GL_ALPHA";								break;
	case GL_ALPHA4:							i = "GL_ALPHA4";							break;
	case GL_ALPHA8:							i = "GL_ALPHA8";							break;
	case GL_ALPHA12:						i = "GL_ALPHA12";							break;
	case GL_ALPHA16:						i = "GL_ALPHA16";							break;
	case GL_LUMINANCE:						i = "GL_LUMINANCE";							break;
	case GL_LUMINANCE4:						i = "GL_LUMINANCE4";						break;
	case GL_LUMINANCE8:						i = "GL_LUMINANCE8";						break;
	case GL_LUMINANCE12:					i = "GL_LUMINANCE12";						break;
	case GL_LUMINANCE16:					i = "GL_LUMINANCE16";						break;
	case GL_LUMINANCE_ALPHA:				i = "GL_LUMINANCE_ALPHA";					break;
	case GL_LUMINANCE4_ALPHA4:				i = "GL_LUMINANCE4_ALPHA4";					break;
	case GL_LUMINANCE6_ALPHA2:				i = "GL_LUMINANCE6_ALPHA2";					break;
	case GL_LUMINANCE8_ALPHA8:				i = "GL_LUMINANCE8_ALPHA8";					break;
	case GL_LUMINANCE12_ALPHA4:				i = "GL_LUMINANCE12_ALPHA4";				break;
	case GL_LUMINANCE12_ALPHA12:			i = "GL_LUMINANCE12_ALPHA12";				break;
	case GL_LUMINANCE16_ALPHA16:			i = "GL_LUMINANCE16_ALPHA16";				break;
	case GL_INTENSITY:						i = "GL_INTENSITY";							break;
	case GL_INTENSITY4:						i = "GL_INTENSITY4";						break;
	case GL_INTENSITY8:						i = "GL_INTENSITY8";						break;
	case GL_INTENSITY12:					i = "GL_INTENSITY12";						break;
	case GL_INTENSITY16:					i = "GL_INTENSITY16";						break;
	case GL_R3_G3_B2:						i = "GL_R3_G3_B2";							break;
	case GL_RGB:							i = "GL_RGB";								break;
	case GL_RGB4:							i = "GL_RGB4";								break;
	case GL_RGB5:							i = "GL_RGB5";								break;
	case GL_RGB8:							i = "GL_RGB8";								break;
	case GL_RGB10:							i = "GL_RGB10";								break;
	case GL_RGB12:							i = "GL_RGB12";								break;
	case GL_RGB16:							i = "GL_RGB16";								break;
	case GL_RGBA:							i = "GL_RGBA";								break;
	case GL_RGBA2:							i = "GL_RGBA2";								break;
	case GL_RGBA4:							i = "GL_RGBA4";								break;
	case GL_RGB5_A1:						i = "GL_RGB5_A1";							break;
	case GL_RGBA8:							i = "GL_RGBA8";								break;
	case GL_RGB10_A2:						i = "GL_RGB10_A2";							break;
	case GL_RGBA12:							i = "GL_RGBA12";							break;
	case GL_RGBA16:							i = "GL_RGBA16";							break;
	case GL_COMPRESSED_ALPHA:				i = "GL_COMPRESSED_ALPHA";					break;
	case GL_COMPRESSED_RGB:					i = "GL_COMPRESSED_RGB";					break;
	case GL_COMPRESSED_RGBA:				i = "GL_COMPRESSED_RGBA";					break;
	case GL_COMPRESSED_LUMINANCE:			i = "GL_COMPRESSED_LUMINANCE";				break;
	case GL_COMPRESSED_LUMINANCE_ALPHA:		i = "GL_COMPRESSED_LUMINANCE_ALPHA";		break;
	case GL_COMPRESSED_INTENSITY:			i = "GL_COMPRESSED_INTENSITY";				break;
	default:								i = Str_VarArgs("0x%X", internalformat);	break;
	}

	switch (format){
	case GL_COLOR_INDEX:					f = "GL_COLOR_INDEX";						break;
	case GL_RED:							f = "GL_RED";								break;
	case GL_GREEN:							f = "GL_GREEN";								break;
	case GL_BLUE:							f = "GL_BLUE";								break;
	case GL_ALPHA:							f = "GL_ALPHA";								break;
	case GL_RGB:							f = "GL_RGB";								break;
	case GL_RGBA:							f = "GL_RGBA";								break;
	case GL_BGR:							f = "GL_BGR";								break;
	case GL_BGRA:							f = "GL_BGRA";								break;
	case GL_LUMINANCE:						f = "GL_LUMINANCE";							break;
	case GL_LUMINANCE_ALPHA:				f = "GL_LUMINANCE_ALPHA";					break;
	default:								f = Str_VarArgs("0x%X", format);			break;
	}

	switch (type){
	case GL_BYTE:							t2 = "GL_BYTE";								break;
	case GL_UNSIGNED_BYTE:					t2 = "GL_UNSIGNED_BYTE";					break;
	case GL_BITMAP:							t2 = "GL_BITMAP";							break;
	case GL_SHORT:							t2 = "GL_SHORT";							break;
	case GL_UNSIGNED_SHORT:					t2 = "GL_UNSIGNED_SHORT";					break;
	case GL_INT:							t2 = "GL_INT";								break;
	case GL_UNSIGNED_INT:					t2 = "GL_UNSIGNED_INT";						break;
	case GL_FLOAT:							t2 = "GL_FLOAT";							break;
	default:								t2 = Str_VarArgs("0x%X", type);				break;
	}

	fprintf(qglState.logFile, "glTexImage2D( %s, %i, %s, %i, %i, %i, %s, %s, %p )\n", t, level, i, width, height, border, f, t2, pixels);
	dllTexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
}

static GLvoid APIENTRY logTexParameterf (GLenum target, GLenum pname, GLfloat param){

	const char	*t, *n, *p;

	switch (target){
	case GL_TEXTURE_1D:					t = "GL_TEXTURE_1D";				break;
	case GL_TEXTURE_2D:					t = "GL_TEXTURE_2D";				break;
	case GL_TEXTURE_3D:					t = "GL_TEXTURE_3D";				break;
	case GL_TEXTURE_CUBE_MAP:			t = "GL_TEXTURE_CUBE_MAP";			break;
	default:							t = Str_VarArgs("0x%X", target);	break;
	}

	switch (pname){
	case GL_TEXTURE_MIN_FILTER:			n = "GL_TEXTURE_MIN_FILTER";		break;
	case GL_TEXTURE_MAG_FILTER:			n = "GL_TEXTURE_MAG_FILTER";		break;
	case GL_TEXTURE_WRAP_S:				n = "GL_TEXTURE_WRAP_S";			break;
	case GL_TEXTURE_WRAP_T:				n = "GL_TEXTURE_WRAP_T";			break;
	case GL_TEXTURE_WRAP_R:				n = "GL_TEXTURE_WRAP_R";			break;
	case GL_TEXTURE_LOD_BIAS:			n = "GL_TEXTURE_LOD_BIAS";			break;
	case GL_TEXTURE_MAX_ANISOTROPY_EXT:	n = "GL_TEXTURE_MAX_ANISOTROPY";	break;
	default:							n = Str_VarArgs("0x%X", pname);		break;
	}

	switch ((int)param){
	case GL_NEAREST:					p = "GL_NEAREST";					break;
	case GL_LINEAR:						p = "GL_LINEAR";					break;
	case GL_NEAREST_MIPMAP_NEAREST:		p = "GL_NEAREST_MIPMAP_NEAREST";	break;
	case GL_LINEAR_MIPMAP_NEAREST:		p = "GL_LINEAR_MIPMAP_NEAREST";		break;
	case GL_NEAREST_MIPMAP_LINEAR:		p = "GL_NEAREST_MIPMAP_LINEAR";		break;
	case GL_LINEAR_MIPMAP_LINEAR:		p = "GL_LINEAR_MIPMAP_LINEAR";		break;
	case GL_REPEAT:						p = "GL_REPEAT";					break;
	case GL_CLAMP:						p = "GL_CLAMP";						break;
	case GL_CLAMP_TO_EDGE:				p = "GL_CLAMP_TO_EDGE";				break;
	case GL_CLAMP_TO_BORDER:			p = "GL_CLAMP_TO_BORDER";			break;
	default:							p = Str_VarArgs("0x%X", param);		break;
	}

	if (pname == GL_TEXTURE_LOD_BIAS || pname == GL_TEXTURE_MAX_ANISOTROPY_EXT)
		p = Str_VarArgs("%g", param);

	fprintf(qglState.logFile, "glTexParameterf( %s, %s, %s )\n", t, n, p);
	dllTexParameterf(target, pname, param);
}

static GLvoid APIENTRY logTexParameterfv (GLenum target, GLenum pname, const GLfloat *params){

	const char	*t, *n;

	switch (target){
	case GL_TEXTURE_1D:					t = "GL_TEXTURE_1D";				break;
	case GL_TEXTURE_2D:					t = "GL_TEXTURE_2D";				break;
	case GL_TEXTURE_3D:					t = "GL_TEXTURE_3D";				break;
	case GL_TEXTURE_CUBE_MAP:			t = "GL_TEXTURE_CUBE_MAP";			break;
	default:							t = Str_VarArgs("0x%X", target);	break;
	}

	switch (pname){
	case GL_TEXTURE_MIN_FILTER:			n = "GL_TEXTURE_MIN_FILTER";		break;
	case GL_TEXTURE_MAG_FILTER:			n = "GL_TEXTURE_MAG_FILTER";		break;
	case GL_TEXTURE_WRAP_S:				n = "GL_TEXTURE_WRAP_S";			break;
	case GL_TEXTURE_WRAP_T:				n = "GL_TEXTURE_WRAP_T";			break;
	case GL_TEXTURE_WRAP_R:				n = "GL_TEXTURE_WRAP_R";			break;
	case GL_TEXTURE_BORDER_COLOR:		n = "GL_TEXTURE_BORDER_COLOR";		break;
	case GL_TEXTURE_PRIORITY:			n = "GL_TEXTURE_PRIORITY";			break;
	case GL_TEXTURE_LOD_BIAS:		n = "GL_TEXTURE_LOD_BIAS";			break;
	case GL_TEXTURE_MAX_ANISOTROPY_EXT:	n = "GL_TEXTURE_MAX_ANISOTROPY";	break;
	default:							n = Str_VarArgs("0x%X", pname);		break;
	}

	fprintf(qglState.logFile, "glTexParameterfv( %s, %s, %p )\n", t, n, params);
	dllTexParameterfv(target, pname, params);
}

static GLvoid APIENTRY logTexParameteri (GLenum target, GLenum pname, GLint param){

	const char	*t, *n, *p;

	switch (target){
	case GL_TEXTURE_1D:					t = "GL_TEXTURE_1D";				break;
	case GL_TEXTURE_2D:					t = "GL_TEXTURE_2D";				break;
	case GL_TEXTURE_3D:					t = "GL_TEXTURE_3D";				break;
	case GL_TEXTURE_CUBE_MAP:			t = "GL_TEXTURE_CUBE_MAP";			break;
	default:							t = Str_VarArgs("0x%X", target);	break;
	}

	switch (pname){
	case GL_TEXTURE_MIN_FILTER:			n = "GL_TEXTURE_MIN_FILTER";		break;
	case GL_TEXTURE_MAG_FILTER:			n = "GL_TEXTURE_MAG_FILTER";		break;
	case GL_TEXTURE_WRAP_S:				n = "GL_TEXTURE_WRAP_S";			break;
	case GL_TEXTURE_WRAP_T:				n = "GL_TEXTURE_WRAP_T";			break;
	case GL_TEXTURE_WRAP_R:				n = "GL_TEXTURE_WRAP_R";			break;
	case GL_TEXTURE_LOD_BIAS:			n = "GL_TEXTURE_LOD_BIAS";			break;
	case GL_TEXTURE_MAX_ANISOTROPY_EXT:	n = "GL_TEXTURE_MAX_ANISOTROPY";	break;
	default:							n = Str_VarArgs("0x%X", pname);		break;
	}

	switch (param){
	case GL_NEAREST:					p = "GL_NEAREST";					break;
	case GL_LINEAR:						p = "GL_LINEAR";					break;
	case GL_NEAREST_MIPMAP_NEAREST:		p = "GL_NEAREST_MIPMAP_NEAREST";	break;
	case GL_LINEAR_MIPMAP_NEAREST:		p = "GL_LINEAR_MIPMAP_NEAREST";		break;
	case GL_NEAREST_MIPMAP_LINEAR:		p = "GL_NEAREST_MIPMAP_LINEAR";		break;
	case GL_LINEAR_MIPMAP_LINEAR:		p = "GL_LINEAR_MIPMAP_LINEAR";		break;
	case GL_REPEAT:						p = "GL_REPEAT";					break;
	case GL_CLAMP:						p = "GL_CLAMP";						break;
	case GL_CLAMP_TO_EDGE:				p = "GL_CLAMP_TO_EDGE";				break;
	case GL_CLAMP_TO_BORDER:			p = "GL_CLAMP_TO_BORDER";			break;
	default:							p = Str_VarArgs("0x%X", param);		break;
	}

	if (pname == GL_TEXTURE_LOD_BIAS_EXT || pname == GL_TEXTURE_MAX_ANISOTROPY_EXT)
		p = Str_VarArgs("%i", param);

	fprintf(qglState.logFile, "glTexParameteri( %s, %s, %s )\n", t, n, p);
	dllTexParameteri(target, pname, param);
}

static GLvoid APIENTRY logTexParameteriv (GLenum target, GLenum pname, const GLint *params){

	const char	*t, *n;

	switch (target){
	case GL_TEXTURE_1D:					t = "GL_TEXTURE_1D";				break;
	case GL_TEXTURE_2D:					t = "GL_TEXTURE_2D";				break;
	case GL_TEXTURE_3D:					t = "GL_TEXTURE_3D";				break;
	case GL_TEXTURE_CUBE_MAP:			t = "GL_TEXTURE_CUBE_MAP";			break;
	default:							t = Str_VarArgs("0x%X", target);	break;
	}

	switch (pname){
	case GL_TEXTURE_MIN_FILTER:			n = "GL_TEXTURE_MIN_FILTER";		break;
	case GL_TEXTURE_MAG_FILTER:			n = "GL_TEXTURE_MAG_FILTER";		break;
	case GL_TEXTURE_WRAP_S:				n = "GL_TEXTURE_WRAP_S";			break;
	case GL_TEXTURE_WRAP_T:				n = "GL_TEXTURE_WRAP_T";			break;
	case GL_TEXTURE_WRAP_R:				n = "GL_TEXTURE_WRAP_R";			break;
	case GL_TEXTURE_BORDER_COLOR:		n = "GL_TEXTURE_BORDER_COLOR";		break;
	case GL_TEXTURE_PRIORITY:			n = "GL_TEXTURE_PRIORITY";			break;
	case GL_TEXTURE_LOD_BIAS:			n = "GL_TEXTURE_LOD_BIAS";			break;
	case GL_TEXTURE_MAX_ANISOTROPY_EXT:	n = "GL_TEXTURE_MAX_ANISOTROPY";	break;
	default:							n = Str_VarArgs("0x%X", pname);		break;
	}

	fprintf(qglState.logFile, "glTexParameteriv( %s, %s, %p )\n", t, n, params);
	dllTexParameteriv(target, pname, params);
}

static GLvoid APIENTRY logTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels){

	const char	*t, *f, *t2;

	switch (target){
	case GL_TEXTURE_1D:			t = "GL_TEXTURE_1D";				break;
	default:					t = Str_VarArgs("0x%X", target);	break;
	}

	switch (format){
	case GL_COLOR_INDEX:		f = "GL_COLOR_INDEX";				break;
	case GL_RED:				f = "GL_RED";						break;
	case GL_GREEN:				f = "GL_GREEN";						break;
	case GL_BLUE:				f = "GL_BLUE";						break;
	case GL_ALPHA:				f = "GL_ALPHA";						break;
	case GL_RGB:				f = "GL_RGB";						break;
	case GL_RGBA:				f = "GL_RGBA";						break;
	case GL_BGR:				f = "GL_BGR";						break;
	case GL_BGRA:				f = "GL_BGRA";						break;
	case GL_LUMINANCE:			f = "GL_LUMINANCE";					break;
	case GL_LUMINANCE_ALPHA:	f = "GL_LUMINANCE_ALPHA";			break;
	default:					f = Str_VarArgs("0x%X", format);	break;
	}

	switch (type){
	case GL_BYTE:				t2 = "GL_BYTE";						break;
	case GL_UNSIGNED_BYTE:		t2 = "GL_UNSIGNED_BYTE";			break;
	case GL_BITMAP:				t2 = "GL_BITMAP";					break;
	case GL_SHORT:				t2 = "GL_SHORT";					break;
	case GL_UNSIGNED_SHORT:		t2 = "GL_UNSIGNED_SHORT";			break;
	case GL_INT:				t2 = "GL_INT";						break;
	case GL_UNSIGNED_INT:		t2 = "GL_UNSIGNED_INT";				break;
	case GL_FLOAT:				t2 = "GL_FLOAT";					break;
	default:					t2 = Str_VarArgs("0x%X", type);		break;
	}

	fprintf(qglState.logFile, "glTexSubImage1D( %s, %i, %i, %i, %s, %s, %p )\n", t, level, xoffset, width, f, t2, pixels);
	dllTexSubImage1D(target, level, xoffset, width, format, type, pixels);
}

static GLvoid APIENTRY logTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels){

	const char	*t, *f, *t2;

	switch (target){
	case GL_TEXTURE_2D:						t = "GL_TEXTURE_2D";					break;
	case GL_TEXTURE_CUBE_MAP_POSITIVE_X:	t = "GL_TEXTURE_CUBE_MAP_POSITIVE_X";	break;
	case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:	t = "GL_TEXTURE_CUBE_MAP_POSITIVE_Y";	break;
	case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:	t = "GL_TEXTURE_CUBE_MAP_POSITIVE_Z";	break;
	case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:	t = "GL_TEXTURE_CUBE_MAP_NEGATIVE_X";	break;
	case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:	t = "GL_TEXTURE_CUBE_MAP_NEGATIVE_Y";	break;
	case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:	t = "GL_TEXTURE_CUBE_MAP_NEGATIVE_Z";	break;
	default:								t = Str_VarArgs("0x%X", target);		break;
	}

	switch (format){
	case GL_COLOR_INDEX:					f = "GL_COLOR_INDEX";					break;
	case GL_RED:							f = "GL_RED";							break;
	case GL_GREEN:							f = "GL_GREEN";							break;
	case GL_BLUE:							f = "GL_BLUE";							break;
	case GL_ALPHA:							f = "GL_ALPHA";							break;
	case GL_RGB:							f = "GL_RGB";							break;
	case GL_RGBA:							f = "GL_RGBA";							break;
	case GL_BGR:							f = "GL_BGR";							break;
	case GL_BGRA:							f = "GL_BGRA";							break;
	case GL_LUMINANCE:						f = "GL_LUMINANCE";						break;
	case GL_LUMINANCE_ALPHA:				f = "GL_LUMINANCE_ALPHA";				break;
	default:								f = Str_VarArgs("0x%X", format);		break;
	}

	switch (type){
	case GL_BYTE:							t2 = "GL_BYTE";							break;
	case GL_UNSIGNED_BYTE:					t2 = "GL_UNSIGNED_BYTE";				break;
	case GL_BITMAP:							t2 = "GL_BITMAP";						break;
	case GL_SHORT:							t2 = "GL_SHORT";						break;
	case GL_UNSIGNED_SHORT:					t2 = "GL_UNSIGNED_SHORT";				break;
	case GL_INT:							t2 = "GL_INT";							break;
	case GL_UNSIGNED_INT:					t2 = "GL_UNSIGNED_INT";					break;
	case GL_FLOAT:							t2 = "GL_FLOAT";						break;
	default:								t2 = Str_VarArgs("0x%X", type);			break;
	}

	fprintf(qglState.logFile, "glTexSubImage2D( %s, %i, %i, %i, %i, %i, %s, %s, %p )\n", t, level, xoffset, yoffset, width, height, f, t2, pixels);
	dllTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
}

static GLvoid APIENTRY logTranslated (GLdouble x, GLdouble y, GLdouble z){

	fprintf(qglState.logFile, "glTranslated( %g, %g, %g )\n", x, y, z);
	dllTranslated(x, y, z);
}

static GLvoid APIENTRY logTranslatef (GLfloat x, GLfloat y, GLfloat z){

	fprintf(qglState.logFile, "glTranslatef( %g, %g, %g )\n", x, y, z);
	dllTranslatef(x, y, z);
}

static GLvoid APIENTRY logVertex2d (GLdouble x, GLdouble y){

	fprintf(qglState.logFile, "glVertex2d( %g, %g )\n", x, y);
	dllVertex2d(x, y);
}

static GLvoid APIENTRY logVertex2dv (const GLdouble *v){

	fprintf(qglState.logFile, "glVertex2dv( %p )\n", v);
	dllVertex2dv(v);
}

static GLvoid APIENTRY logVertex2f (GLfloat x, GLfloat y){

	fprintf(qglState.logFile, "glVertex2f( %g, %g )\n", x, y);
	dllVertex2f(x, y);
}

static GLvoid APIENTRY logVertex2fv (const GLfloat *v){

	fprintf(qglState.logFile, "glVertex2fv( %p )\n", v);
	dllVertex2fv(v);
}

static GLvoid APIENTRY logVertex2i (GLint x, GLint y){

	fprintf(qglState.logFile, "glVertex2i( %i, %i )\n", x, y);
	dllVertex2i(x, y);
}

static GLvoid APIENTRY logVertex2iv (const GLint *v){

	fprintf(qglState.logFile, "glVertex2iv( %p )\n", v);
	dllVertex2iv(v);
}

static GLvoid APIENTRY logVertex2s (GLshort x, GLshort y){

	fprintf(qglState.logFile, "glVertex2s( %i, %i )\n", x, y);
	dllVertex2s(x, y);
}

static GLvoid APIENTRY logVertex2sv (const GLshort *v){

	fprintf(qglState.logFile, "glVertex2sv( %p )\n", v);
	dllVertex2sv(v);
}

static GLvoid APIENTRY logVertex3d (GLdouble x, GLdouble y, GLdouble z){

	fprintf(qglState.logFile, "glVertex3d( %g, %g, %g )\n", x, y, z);
	dllVertex3d(x, y, z);
}

static GLvoid APIENTRY logVertex3dv (const GLdouble *v){

	fprintf(qglState.logFile, "glVertex3dv( %p )\n", v);
	dllVertex3dv(v);
}

static GLvoid APIENTRY logVertex3f (GLfloat x, GLfloat y, GLfloat z){

	fprintf(qglState.logFile, "glVertex3f( %g, %g, %g )\n", x, y, z);
	dllVertex3f(x, y, z);
}

static GLvoid APIENTRY logVertex3fv (const GLfloat *v){

	fprintf(qglState.logFile, "glVertex3fv( %p )\n", v);
	dllVertex3fv(v);
}

static GLvoid APIENTRY logVertex3i (GLint x, GLint y, GLint z){

	fprintf(qglState.logFile, "glVertex3i( %i, %i, %i )\n", x, y, z);
	dllVertex3i(x, y, z);
}

static GLvoid APIENTRY logVertex3iv (const GLint *v){

	fprintf(qglState.logFile, "glVertex3iv( %p )\n", v);
	dllVertex3iv(v);
}

static GLvoid APIENTRY logVertex3s (GLshort x, GLshort y, GLshort z){

	fprintf(qglState.logFile, "glVertex3s( %i, %i, %i )\n", x, y, z);
	dllVertex3s(x, y, z);
}

static GLvoid APIENTRY logVertex3sv (const GLshort *v){

	fprintf(qglState.logFile, "glVertex3sv( %p )\n", v);
	dllVertex3sv(v);
}

static GLvoid APIENTRY logVertex4d (GLdouble x, GLdouble y, GLdouble z, GLdouble w){

	fprintf(qglState.logFile, "glVertex4d( %g, %g, %g, %g )\n", x, y, z, w);
	dllVertex4d(x, y, z, w);
}

static GLvoid APIENTRY logVertex4dv (const GLdouble *v){

	fprintf(qglState.logFile, "glVertex4dv( %p )\n", v);
	dllVertex4dv(v);
}

static GLvoid APIENTRY logVertex4f (GLfloat x, GLfloat y, GLfloat z, GLfloat w){

	fprintf(qglState.logFile, "glVertex4f( %g, %g, %g, %g )\n", x, y, z, w);
	dllVertex4f(x, y, z, w);
}

static GLvoid APIENTRY logVertex4fv (const GLfloat *v){

	fprintf(qglState.logFile, "glVertex4fv( %p )\n", v);
	dllVertex4fv(v);
}

static GLvoid APIENTRY logVertex4i (GLint x, GLint y, GLint z, GLint w){

	fprintf(qglState.logFile, "glVertex4i( %i, %i, %i, %i )\n", x, y, z, w);
	dllVertex4i(x, y, z, w);
}

static GLvoid APIENTRY logVertex4iv (const GLint *v){

	fprintf(qglState.logFile, "glVertex4iv( %p )\n", v);
	dllVertex4iv(v);
}

static GLvoid APIENTRY logVertex4s (GLshort x, GLshort y, GLshort z, GLshort w){

	fprintf(qglState.logFile, "glVertex4s( %i, %i, %i, %i )\n", x, y, z, w);
	dllVertex4s(x, y, z, w);
}

static GLvoid APIENTRY logVertex4sv (const GLshort *v){

	fprintf(qglState.logFile, "glVertex4sv( %p )\n", v);
	dllVertex4sv(v);
}

static GLvoid APIENTRY logVertexPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer){

	const char	*t;

	switch (type){
	case GL_BYTE:			t = "GL_BYTE";					break;
	case GL_UNSIGNED_BYTE:	t = "GL_UNSIGNED_BYTE";			break;
	case GL_SHORT:			t = "GL_SHORT";					break;
	case GL_UNSIGNED_SHORT:	t = "GL_UNSIGNED_SHORT";		break;
	case GL_INT:			t = "GL_INT";					break;
	case GL_UNSIGNED_INT:	t = "GL_UNSIGNED_INT";			break;
	case GL_FLOAT:			t = "GL_FLOAT";					break;
	case GL_DOUBLE:			t = "GL_DOUBLE";				break;
	default:				t = Str_VarArgs("0x%X", type);	break;
	}

	fprintf(qglState.logFile, "glVertexPointer( %i, %s, %i, %p )\n", size, t, stride, pointer);
	dllVertexPointer(size, type, stride, pointer);
}

static GLvoid APIENTRY logViewport (GLint x, GLint y, GLsizei width, GLsizei height){

	fprintf(qglState.logFile, "glViewport( %i, %i, %i, %i )\n", x, y, width, height);
	dllViewport(x, y, width, height);
}

static GLvoid APIENTRY logActiveTexture (GLenum texture){

	const char	*t;

	if (texture >= GL_TEXTURE0 && texture <= GL_TEXTURE31)
		t = Str_VarArgs("GL_TEXTURE%i", texture - GL_TEXTURE0);
	else
		t = Str_VarArgs("0x%X", texture);

	fprintf(qglState.logFile, "glActiveTexture( %s )\n", t);
	dllActiveTexture(texture);
}

static GLvoid APIENTRY logGenBuffers (GLsizei n, GLuint *buffers){

	fprintf(qglState.logFile, "glGenBuffers( %i, %p )\n", n, buffers);
	dllGenBuffers(n, buffers);
}

static GLvoid APIENTRY logDeleteBuffers (GLsizei n, const GLuint *buffers){

	fprintf(qglState.logFile, "glDeleteBuffers( %i, %p )\n", n, buffers);
	dllDeleteBuffers(n, buffers);
}

static GLvoid APIENTRY logBindBuffer (GLenum target, GLuint buffer){

	const char	*t;

	switch (target){
	case GL_ARRAY_BUFFER:			t = "GL_ARRAY_BUFFER";				break;
	case GL_ELEMENT_ARRAY_BUFFER:	t = "GL_ELEMENT_ARRAY_BUFFER";		break;
	default:						t = Str_VarArgs("0x%X", target);	break;
	}

	fprintf(qglState.logFile, "glBindBuffer( %s, %u )\n", t, buffer);
	dllBindBuffer(target, buffer);
}

static GLvoid APIENTRY logBufferData (GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage){

	const char	*t, *u;

	switch (target){
	case GL_ARRAY_BUFFER:			t = "GL_ARRAY_BUFFER";				break;
	case GL_ELEMENT_ARRAY_BUFFER:	t = "GL_ELEMENT_ARRAY_BUFFER";		break;
	default:						t = Str_VarArgs("0x%X", target);	break;
	}

	switch (usage){
	case GL_STATIC_DRAW:			u = "GL_STATIC_DRAW";				break;
	case GL_STATIC_READ:			u = "GL_STATIC_READ";				break;
	case GL_STATIC_COPY:			u = "GL_STATIC_COPY";				break;
	case GL_DYNAMIC_DRAW:			u = "GL_DYNAMIC_DRAW";				break;
	case GL_DYNAMIC_READ:			u = "GL_DYNAMIC_READ";				break;
	case GL_DYNAMIC_COPY:			u = "GL_DYNAMIC_COPY";				break;
	case GL_STREAM_DRAW:			u = "GL_STREAM_DRAW";				break;
	case GL_STREAM_READ:			u = "GL_STREAM_READ";				break;
	case GL_STREAM_COPY:			u = "GL_STREAM_COPY";				break;
	default:						u = Str_VarArgs("0x%X", usage);		break;
	}

	fprintf(qglState.logFile, "glBufferData( %s, %i, %p, %s )\n", t, size, data, u);
	dllBufferData(target, size, data, usage);
}

static GLvoid APIENTRY logBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data){

	const char	*t;

	switch (target){
	case GL_ARRAY_BUFFER:			t = "GL_ARRAY_BUFFER";				break;
	case GL_ELEMENT_ARRAY_BUFFER:	t = "GL_ELEMENT_ARRAY_BUFFER";		break;
	default:						t = Str_VarArgs("0x%X", target);	break;
	}

	fprintf(qglState.logFile, "glBufferSubData( %s, %i, %i, %p )\n", t, offset, size, data);
	dllBufferSubData(target, offset, size, data);
}

static GLvoid * APIENTRY logMapBuffer (GLenum target, GLenum access){

	const char	*t, *a;

	switch (target){
	case GL_ARRAY_BUFFER:			t = "GL_ARRAY_BUFFER";				break;
	case GL_ELEMENT_ARRAY_BUFFER:	t = "GL_ELEMENT_ARRAY_BUFFER";		break;
	default:						t = Str_VarArgs("0x%X", target);	break;
	}

	switch (access){
	case GL_READ_ONLY:				a = "GL_READ_ONLY";					break;
	case GL_WRITE_ONLY:				a = "GL_WRITE_ONLY";				break;
	case GL_READ_WRITE:				a = "GL_READ_WRITE";				break;
	default:						a = Str_VarArgs("0x%X", access);	break;
	}

	fprintf(qglState.logFile, "glMapBuffer( %s, %s )\n", t, a);
	return dllMapBuffer(target, access);
}

static GLboolean APIENTRY logUnmapBuffer (GLenum target){

	const char	*t;

	switch (target){
	case GL_ARRAY_BUFFER:			t = "GL_ARRAY_BUFFER";				break;
	case GL_ELEMENT_ARRAY_BUFFER:	t = "GL_ELEMENT_ARRAY_BUFFER";		break;
	default:						t = Str_VarArgs("0x%X", target);	break;
	}

	fprintf(qglState.logFile, "glUnmapBuffer( %s )\n", t);
	return dllUnmapBuffer(target);
}

static GLuint APIENTRY logCreateShader (GLenum type){

	const char	*t;

	switch (type){
	case GL_VERTEX_SHADER:		t = "GL_VERTEX_SHADER";			break;
	case GL_FRAGMENT_SHADER:	t = "GL_FRAGMENT_SHADER";		break;
	default:					t = Str_VarArgs("0x%X", type);	break;
	}

	fprintf(qglState.logFile, "glCreateShader( %s )\n", t);
	return dllCreateShader(type);
}

static GLuint APIENTRY logCreateProgram (GLvoid){

	fprintf(qglState.logFile, "glCreateProgram()\n");
	return dllCreateProgram();
}

static GLvoid APIENTRY logDeleteShader (GLuint shader){

	fprintf(qglState.logFile, "glDeleteShader( %u )\n", shader);
	dllDeleteShader(shader);
}

static GLvoid APIENTRY logDeleteProgram (GLuint program){

	fprintf(qglState.logFile, "glDeleteProgram( %u )\n", program);
	dllDeleteProgram(program);
}

static GLvoid APIENTRY logGetShaderiv (GLuint shader, GLenum pname, GLint *params){

	fprintf(qglState.logFile, "glGetShaderiv( %u, 0x%X, %p )\n", shader, pname, params);
	dllGetShaderiv(shader, pname, params);
}

static GLvoid APIENTRY logGetProgramiv (GLuint program, GLenum pname, GLint *params){

	fprintf(qglState.logFile, "glGetProgramiv( %u, 0x%X, %p )\n", program, pname, params);
	dllGetProgramiv(program, pname, params);
}

static GLvoid APIENTRY logGetShaderInfoLog (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog){

	fprintf(qglState.logFile, "glGetShaderInfoLog( %u, %i, %p, %p )\n", shader, bufSize, length, infoLog);
	dllGetShaderInfoLog(shader, bufSize, length, infoLog);
}

static GLvoid APIENTRY logGetProgramInfoLog (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog){

	fprintf(qglState.logFile, "glGetProgramInfoLog( %u, %i, %p, %p )\n", program, bufSize, length, infoLog);
	dllGetProgramInfoLog(program, bufSize, length, infoLog);
}

static GLvoid APIENTRY logShaderSource (GLuint shader, GLsizei count, const GLchar **string, const GLint *length){

	fprintf(qglState.logFile, "glShaderSource( %u, %i, %p, %p )\n", shader, count, string, length);
	dllShaderSource(shader, count, string, length);
}

static GLvoid APIENTRY logCompileShader (GLuint shader){

	fprintf(qglState.logFile, "glCompileShader( %u )\n", shader);
	dllCompileShader(shader);
}

static GLvoid APIENTRY logAttachShader (GLuint program, GLuint shader){

	fprintf(qglState.logFile, "glAttachShader( %u, %u )\n", program, shader);
	dllAttachShader(program, shader);
}

static GLvoid APIENTRY logDetachShader (GLuint program, GLuint shader){

	fprintf(qglState.logFile, "glDetachShader( %u, %u )\n", program, shader);
	dllDetachShader(program, shader);
}

static GLvoid APIENTRY logLinkProgram (GLuint program){

	fprintf(qglState.logFile, "glLinkProgram( %u )\n", program);
	dllLinkProgram(program);
}

static GLvoid APIENTRY logUseProgram (GLuint program){

	fprintf(qglState.logFile, "glUseProgram( %u )\n", program);
	dllUseProgram(program);
}

static GLvoid APIENTRY logVertexAttribPointer (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer){

	const char	*t, *n;

	switch (type){
	case GL_BYTE:			t = "GL_BYTE";							break;
	case GL_UNSIGNED_BYTE:	t = "GL_UNSIGNED_BYTE";					break;
	case GL_SHORT:			t = "GL_SHORT";							break;
	case GL_UNSIGNED_SHORT:	t = "GL_UNSIGNED_SHORT";				break;
	case GL_INT:			t = "GL_INT";							break;
	case GL_UNSIGNED_INT:	t = "GL_UNSIGNED_INT";					break;
	case GL_FLOAT:			t = "GL_FLOAT";							break;
	case GL_DOUBLE:			t = "GL_DOUBLE";						break;
	default:				t = Str_VarArgs("0x%X", type);			break;
	}

	switch (normalized){
	case GL_FALSE:			n = "GL_FALSE";							break;
	case GL_TRUE:			n = "GL_TRUE";							break;
	default:				n = Str_VarArgs("0x%X", normalized);	break;
	}

	fprintf(qglState.logFile, "glVertexAttribPointer( %u, %i, %s, %s, %i, %p )\n", index, size, t, n, stride, pointer);
	dllVertexAttribPointer(index, size, type, normalized, stride, pointer);
}

static GLvoid APIENTRY logEnableVertexAttribArray (GLuint index){

	fprintf(qglState.logFile, "glEnableVertexAttribArray( %u )\n", index);
	dllEnableVertexAttribArray(index);
}

static GLvoid APIENTRY logDisableVertexAttribArray (GLuint index){

	fprintf(qglState.logFile, "glDisableVertexAttribArray( %u )\n", index);
	dllDisableVertexAttribArray(index);
}

static GLvoid APIENTRY logBindAttribLocation (GLuint program, GLuint index, const GLchar *name){

	fprintf(qglState.logFile, "glBindAttribLocation( %u, %u, %s )\n", program, index, name);
	dllBindAttribLocation(program, index, name);
}

static GLint APIENTRY logGetAttribLocation (GLuint program, const GLchar *name){

	fprintf(qglState.logFile, "glGetAttribLocation( %u, %s )\n", program, name);
	return dllGetAttribLocation(program, name);
}

static GLvoid APIENTRY logGetActiveUniform (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name){

	fprintf(qglState.logFile, "glGetActiveUniform( %u, %u, %i, %p, %p, %p, %p )\n", program, index, bufSize, length, size, type, name);
	dllGetActiveUniform(program, index, bufSize, length, size, type, name);
}

static GLint APIENTRY logGetUniformLocation (GLuint program, const GLchar *name){

	fprintf(qglState.logFile, "glGetUniformLocation( %u, %s )\n", program, name);
	return dllGetUniformLocation(program, name);
}

static GLvoid APIENTRY logUniform1f (GLint location, GLfloat v0){

	fprintf(qglState.logFile, "glUniform1f( %i, %g )\n", location, v0);
	dllUniform1f(location, v0);
}

static GLvoid APIENTRY logUniform2f (GLint location, GLfloat v0, GLfloat v1){

	fprintf(qglState.logFile, "glUniform2f( %i, %g, %g )\n", location, v0, v1);
	dllUniform2f(location, v0, v1);
}

static GLvoid APIENTRY logUniform3f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2){

	fprintf(qglState.logFile, "glUniform3f( %i, %g, %g, %g )\n", location, v0, v1, v2);
	dllUniform3f(location, v0, v1, v2);
}

static GLvoid APIENTRY logUniform4f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3){

	fprintf(qglState.logFile, "glUniform4f( %i, %g, %g, %g, %g )\n", location, v0, v1, v2, v3);
	dllUniform4f(location, v0, v1, v2, v3);
}

static GLvoid APIENTRY logUniform1i (GLint location, GLint v0){

	fprintf(qglState.logFile, "glUniform1i( %i, %g )\n", location, v0);
	dllUniform1i(location, v0);
}

static GLvoid APIENTRY logUniform2i (GLint location, GLint v0, GLint v1){

	fprintf(qglState.logFile, "glUniform2i( %i, %g, %g )\n", location, v0, v1);
	dllUniform2i(location, v0, v1);
}

static GLvoid APIENTRY logUniform3i (GLint location, GLint v0, GLint v1, GLint v2){

	fprintf(qglState.logFile, "glUniform3i( %i, %g, %g, %g )\n", location, v0, v1, v2);
	dllUniform3i(location, v0, v1, v2);
}

static GLvoid APIENTRY logUniform4i (GLint location, GLint v0, GLint v1, GLint v2, GLint v3){

	fprintf(qglState.logFile, "glUniform4i( %i, %g, %g, %g, %g )\n", location, v0, v1, v2, v3);
	dllUniform4i(location, v0, v1, v2, v3);
}

static GLvoid APIENTRY logUniform1fv (GLint location, GLsizei count, const GLfloat *value){

	fprintf(qglState.logFile, "glUniform1fv( %i, %i, %p )\n", location, count, value);
	dllUniform1fv(location, count, value);
}

static GLvoid APIENTRY logUniform2fv (GLint location, GLsizei count, const GLfloat *value){

	fprintf(qglState.logFile, "glUniform2fv( %i, %i, %p )\n", location, count, value);
	dllUniform2fv(location, count, value);
}

static GLvoid APIENTRY logUniform3fv (GLint location, GLsizei count, const GLfloat *value){

	fprintf(qglState.logFile, "glUniform3fv( %i, %i, %p )\n", location, count, value);
	dllUniform3fv(location, count, value);
}

static GLvoid APIENTRY logUniform4fv (GLint location, GLsizei count, const GLfloat *value){

	fprintf(qglState.logFile, "glUniform4fv( %i, %i, %p )\n", location, count, value);
	dllUniform4fv(location, count, value);
}

static GLvoid APIENTRY logUniform1iv (GLint location, GLsizei count, const GLint *value){

	fprintf(qglState.logFile, "glUniform1iv( %i, %i, %p )\n", location, count, value);
	dllUniform1iv(location, count, value);
}

static GLvoid APIENTRY logUniform2iv (GLint location, GLsizei count, const GLint *value){

	fprintf(qglState.logFile, "glUniform2iv( %i, %i, %p )\n", location, count, value);
	dllUniform2iv(location, count, value);
}

static GLvoid APIENTRY logUniform3iv (GLint location, GLsizei count, const GLint *value){

	fprintf(qglState.logFile, "glUniform3iv( %i, %i, %p )\n", location, count, value);
	dllUniform3iv(location, count, value);
}

static GLvoid APIENTRY logUniform4iv (GLint location, GLsizei count, const GLint *value){

	fprintf(qglState.logFile, "glUniform4iv( %i, %i, %p )\n", location, count, value);
	dllUniform4iv(location, count, value);
}

static GLvoid APIENTRY logUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value){

	const char	*t;

	switch (transpose){
	case GL_FALSE:	t = "GL_FALSE";						break;
	case GL_TRUE:	t = "GL_TRUE";						break;
	default:		t = Str_VarArgs("0x%X", transpose);	break;
	}

	fprintf(qglState.logFile, "glUniformMatrix2fv( %i, %i, %s, %p )\n", location, count, t, value);
	dllUniformMatrix2fv(location, count, transpose, value);
}

static GLvoid APIENTRY logUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value){

	const char	*t;

	switch (transpose){
	case GL_FALSE:	t = "GL_FALSE";						break;
	case GL_TRUE:	t = "GL_TRUE";						break;
	default:		t = Str_VarArgs("0x%X", transpose);	break;
	}

	fprintf(qglState.logFile, "glUniformMatrix3fv( %i, %i, %s, %p )\n", location, count, t, value);
	dllUniformMatrix3fv(location, count, transpose, value);
}

static GLvoid APIENTRY logUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value){

	const char	*t;

	switch (transpose){
	case GL_FALSE:	t = "GL_FALSE";						break;
	case GL_TRUE:	t = "GL_TRUE";						break;
	default:		t = Str_VarArgs("0x%X", transpose);	break;
	}

	fprintf(qglState.logFile, "glUniformMatrix4fv( %i, %i, %s, %p )\n", location, count, t, value);
	dllUniformMatrix4fv(location, count, transpose, value);
}

static GLvoid APIENTRY logStencilFuncSeparate (GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask){

	const char	*ff, *bf;

	switch (frontfunc){
	case GL_NEVER:		ff = "GL_NEVER";						break;
	case GL_LESS:		ff = "GL_LESS";							break;
	case GL_LEQUAL:		ff = "GL_LEQUAL";						break;
	case GL_GREATER:	ff = "GL_GREATER";						break;
	case GL_GEQUAL:		ff = "GL_GEQUAL";						break;
	case GL_EQUAL:		ff = "GL_EQUAL";						break;
	case GL_NOTEQUAL:	ff = "GL_NOTEQUAL";						break;
	case GL_ALWAYS:		ff = "GL_ALWAYS";						break;
	default:			ff = Str_VarArgs("0x%X", frontfunc);	break;
	}

	switch (backfunc){
	case GL_NEVER:		bf = "GL_NEVER";						break;
	case GL_LESS:		bf = "GL_LESS";							break;
	case GL_LEQUAL:		bf = "GL_LEQUAL";						break;
	case GL_GREATER:	bf = "GL_GREATER";						break;
	case GL_GEQUAL:		bf = "GL_GEQUAL";						break;
	case GL_EQUAL:		bf = "GL_EQUAL";						break;
	case GL_NOTEQUAL:	bf = "GL_NOTEQUAL";						break;
	case GL_ALWAYS:		bf = "GL_ALWAYS";						break;
	default:			bf = Str_VarArgs("0x%X", backfunc);		break;
	}

	fprintf(qglState.logFile, "glStencilFuncSeparate( %s, %s, %i, %u )\n", ff, bf, ref, mask);
	dllStencilFuncSeparate(frontfunc, backfunc, ref, mask);
}

static GLvoid APIENTRY logStencilOpSeparate (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass){

	const char	*f, *sf, *dpf, *dpp;

	switch (face){
	case GL_FRONT:			f = "GL_FRONT";						break;
	case GL_BACK:			f = "GL_BACK";						break;
	case GL_FRONT_AND_BACK:	f = "GL_FRONT_AND_BACK";			break;
	default:				f = Str_VarArgs("0x%X", face);		break;
	}

	switch (sfail){
	case GL_KEEP:			sf = "GL_KEEP";						break;
	case GL_ZERO:			sf = "GL_ZERO";						break;
	case GL_REPLACE:		sf = "GL_REPLACE";					break;
	case GL_INCR:			sf = "GL_INCR";						break;
	case GL_INCR_WRAP:		sf = "GL_INCR_WRAP";				break;
	case GL_DECR:			sf = "GL_DECR";						break;
	case GL_DECR_WRAP:		sf = "GL_DECR_WRAP";				break;
	case GL_INVERT:			sf = "GL_INVERT";					break;
	default:				sf = Str_VarArgs("0x%X", sfail);	break;
	}

	switch (dpfail){
	case GL_KEEP:			dpf = "GL_KEEP";					break;
	case GL_ZERO:			dpf = "GL_ZERO";					break;
	case GL_REPLACE:		dpf = "GL_REPLACE";					break;
	case GL_INCR:			dpf = "GL_INCR";					break;
	case GL_INCR_WRAP:		dpf = "GL_INCR_WRAP";				break;
	case GL_DECR:			dpf = "GL_DECR";					break;
	case GL_DECR_WRAP:		dpf = "GL_DECR_WRAP";				break;
	case GL_INVERT:			dpf = "GL_INVERT";					break;
	default:				dpf = Str_VarArgs("0x%X", dpfail);	break;
	}

	switch (dppass){
	case GL_KEEP:			dpp = "GL_KEEP";					break;
	case GL_ZERO:			dpp = "GL_ZERO";					break;
	case GL_REPLACE:		dpp = "GL_REPLACE";					break;
	case GL_INCR:			dpp = "GL_INCR";					break;
	case GL_INCR_WRAP:		dpp = "GL_INCR_WRAP";				break;
	case GL_DECR:			dpp = "GL_DECR";					break;
	case GL_DECR_WRAP:		dpp = "GL_DECR_WRAP";				break;
	case GL_INVERT:			dpp = "GL_INVERT";					break;
	default:				dpp = Str_VarArgs("0x%X", dppass);	break;
	}

	fprintf(qglState.logFile, "glStencilOpSeparate( %s, %s, %s, %s )\n", f, sf, dpf, dpp);
	dllStencilOpSeparate(face, sfail, dpfail, dppass);
}

static GLvoid APIENTRY logStencilMaskSeparate (GLenum face, GLuint mask){

	const char	*f;

	switch (face){
	case GL_FRONT:			f = "GL_FRONT";					break;
	case GL_BACK:			f = "GL_BACK";					break;
	case GL_FRONT_AND_BACK:	f = "GL_FRONT_AND_BACK";		break;
	default:				f = Str_VarArgs("0x%X", face);	break;
	}

	fprintf(qglState.logFile, "glStencilMaskSeparate( %s, %u )\n", f, mask);
	dllStencilMaskSeparate(face, mask);
}

static GLvoid APIENTRY logDepthBoundsEXT (GLclampd zmin, GLclampd zmax){

	fprintf(qglState.logFile, "glDepthBoundsEXT( %g, %g )\n", zmin, zmax);
	dllDepthBoundsEXT(zmin, zmax);
}

static BOOL WINAPI logSwapIntervalEXT (int interval){

	fprintf(qglState.logFile, "wglSwapIntervalEXT( %i )\n", interval);
	return dllSwapIntervalEXT(interval);
}


// ============================================================================


/*
 ==================
 QGL_EnableLogging
 ==================
*/
void QGL_EnableLogging (bool enable){

	const char	*savePath, *game;
	FILE		*f;
	time_t		clock;
	struct tm	*curTime;
	int			i;

	// Extensions are initialized later, so we need to set the pointers
	if (!qglState.extensionPointers){
		qglState.extensionPointers = true;

		dllActiveTexture			= qglActiveTexture;

		dllGenBuffers				= qglGenBuffers;
		dllDeleteBuffers			= qglDeleteBuffers;
		dllBindBuffer				= qglBindBuffer;
		dllBufferData				= qglBufferData;
		dllBufferSubData			= qglBufferSubData;
		dllMapBuffer				= qglMapBuffer;
		dllUnmapBuffer				= qglUnmapBuffer;

		dllCreateShader				= qglCreateShader;
		dllCreateProgram			= qglCreateProgram;
		dllDeleteShader				= qglDeleteShader;
		dllDeleteProgram			= qglDeleteProgram;
		dllGetShaderiv				= qglGetShaderiv;
		dllGetProgramiv				= qglGetProgramiv;
		dllGetShaderInfoLog			= qglGetShaderInfoLog;
		dllGetProgramInfoLog		= qglGetProgramInfoLog;
		dllShaderSource				= qglShaderSource;
		dllCompileShader			= qglCompileShader;
		dllAttachShader				= qglAttachShader;
		dllDetachShader				= qglDetachShader;
		dllLinkProgram				= qglLinkProgram;
		dllUseProgram				= qglUseProgram;
		dllVertexAttribPointer		= qglVertexAttribPointer;
		dllEnableVertexAttribArray	= qglEnableVertexAttribArray;
		dllDisableVertexAttribArray	= qglDisableVertexAttribArray;
		dllBindAttribLocation		= qglBindAttribLocation;
		dllGetAttribLocation		= qglGetAttribLocation;
		dllGetActiveUniform			= qglGetActiveUniform;
		dllGetUniformLocation		= qglGetUniformLocation;
		dllUniform1f				= qglUniform1f;
		dllUniform2f				= qglUniform2f;
		dllUniform3f				= qglUniform3f;
		dllUniform4f				= qglUniform4f;
		dllUniform1i				= qglUniform1i;
		dllUniform2i				= qglUniform2i;
		dllUniform3i				= qglUniform3i;
		dllUniform4i				= qglUniform4i;
		dllUniform1fv				= qglUniform1fv;
		dllUniform2fv				= qglUniform2fv;
		dllUniform3fv				= qglUniform3fv;
		dllUniform4fv				= qglUniform4fv;
		dllUniform1iv				= qglUniform1iv;
		dllUniform2iv				= qglUniform2iv;
		dllUniform3iv				= qglUniform3iv;
		dllUniform4iv				= qglUniform4iv;
		dllUniformMatrix2fv			= qglUniformMatrix2fv;
		dllUniformMatrix3fv			= qglUniformMatrix3fv;
		dllUniformMatrix4fv			= qglUniformMatrix4fv;

		dllStencilFuncSeparate		= qglStencilFuncSeparate;
		dllStencilOpSeparate		= qglStencilOpSeparate;
		dllStencilMaskSeparate		= qglStencilMaskSeparate;

		dllDepthBoundsEXT			= qglDepthBoundsEXT;

		dllSwapIntervalEXT			= qwglSwapIntervalEXT;
	}

	if (enable){
		if (qglState.logFile){
			qglState.logFileFrames++;
			return;
		}

		// Find a file name to save it to.
		// If we can't find a file name, the last one will be overwritten.
		savePath = CVar_GetVariableString("fs_savePath");
		game = CVar_GetVariableString("fs_game");

		for (i = 0; i <= 9999; i++){
			Str_SPrintf(qglState.logFileName, sizeof(qglState.logFileName), "%s\\%s\\renderer_%i.log", savePath, game, i);

			f = fopen(qglState.logFileName, "rt");
			if (!f)
				break;

			fclose(f);
		}

		qglState.logFile = fopen(qglState.logFileName, "wt");
		if (!qglState.logFile)
			return;

		qglState.logFileFrames = 1;

		time(&clock);
		curTime = localtime(&clock);

		fprintf(qglState.logFile, "%s %s (%s %s)", ENGINE_VERSION, BUILD_STRING, __DATE__, __TIME__);
		fprintf(qglState.logFile, "\nLog file opened on %s\n\n", asctime(curTime));

		qglAccum					= logAccum;
		qglAlphaFunc				= logAlphaFunc;
		qglAreTexturesResident		= logAreTexturesResident;
		qglArrayElement				= logArrayElement;
		qglBegin					= logBegin;
		qglBindTexture				= logBindTexture;
		qglBitmap					= logBitmap;
		qglBlendFunc				= logBlendFunc;
		qglCallList					= logCallList;
		qglCallLists				= logCallLists;
		qglClear					= logClear;
		qglClearAccum				= logClearAccum;
		qglClearColor				= logClearColor;
		qglClearDepth				= logClearDepth;
		qglClearIndex				= logClearIndex;
		qglClearStencil				= logClearStencil;
		qglClipPlane				= logClipPlane;
		qglColor3b					= logColor3b;
		qglColor3bv					= logColor3bv;
		qglColor3d					= logColor3d;
		qglColor3dv					= logColor3dv;
		qglColor3f					= logColor3f;
		qglColor3fv					= logColor3fv;
		qglColor3i					= logColor3i;
		qglColor3iv					= logColor3iv;
		qglColor3s					= logColor3s;
		qglColor3sv					= logColor3sv;
		qglColor3ub					= logColor3ub;
		qglColor3ubv				= logColor3ubv;
		qglColor3ui					= logColor3ui;
		qglColor3uiv				= logColor3uiv;
		qglColor3us					= logColor3us;
		qglColor3usv				= logColor3usv;
		qglColor4b					= logColor4b;
		qglColor4bv					= logColor4bv;
		qglColor4d					= logColor4d;
		qglColor4dv					= logColor4dv;
		qglColor4f					= logColor4f;
		qglColor4fv					= logColor4fv;
		qglColor4i					= logColor4i;
		qglColor4iv					= logColor4iv;
		qglColor4s					= logColor4s;
		qglColor4sv					= logColor4sv;
		qglColor4ub					= logColor4ub;
		qglColor4ubv				= logColor4ubv;
		qglColor4ui					= logColor4ui;
		qglColor4uiv				= logColor4uiv;
		qglColor4us					= logColor4us;
		qglColor4usv				= logColor4usv;
		qglColorMask				= logColorMask;
		qglColorMaterial			= logColorMaterial;
		qglColorPointer				= logColorPointer;
		qglCopyPixels				= logCopyPixels;
		qglCopyTexImage1D			= logCopyTexImage1D;
		qglCopyTexImage2D			= logCopyTexImage2D;
		qglCopyTexSubImage1D		= logCopyTexSubImage1D;
		qglCopyTexSubImage2D		= logCopyTexSubImage2D;
		qglCullFace					= logCullFace;
		qglDeleteLists				= logDeleteLists;
		qglDeleteTextures			= logDeleteTextures;
		qglDepthFunc				= logDepthFunc;
		qglDepthMask				= logDepthMask;
		qglDepthRange				= logDepthRange;
		qglDisable					= logDisable;
		qglDisableClientState		= logDisableClientState;
		qglDrawArrays				= logDrawArrays;
		qglDrawBuffer				= logDrawBuffer;
		qglDrawElements				= logDrawElements;
		qglDrawPixels				= logDrawPixels;
		qglEdgeFlag					= logEdgeFlag;
		qglEdgeFlagPointer			= logEdgeFlagPointer;
		qglEdgeFlagv				= logEdgeFlagv;
		qglEnable					= logEnable;
		qglEnableClientState		= logEnableClientState;
		qglEnd						= logEnd;
		qglEndList					= logEndList;
		qglEvalCoord1d				= logEvalCoord1d;
		qglEvalCoord1dv				= logEvalCoord1dv;
		qglEvalCoord1f				= logEvalCoord1f;
		qglEvalCoord1fv				= logEvalCoord1fv;
		qglEvalCoord2d				= logEvalCoord2d;
		qglEvalCoord2dv				= logEvalCoord2dv;
		qglEvalCoord2f				= logEvalCoord2f;
		qglEvalCoord2fv				= logEvalCoord2fv;
		qglEvalMesh1				= logEvalMesh1;
		qglEvalMesh2				= logEvalMesh2;
		qglEvalPoint1				= logEvalPoint1;
		qglEvalPoint2				= logEvalPoint2;
		qglFeedbackBuffer			= logFeedbackBuffer;
		qglFinish					= logFinish;
		qglFlush					= logFlush;
		qglFogf						= logFogf;
		qglFogfv					= logFogfv;
		qglFogi						= logFogi;
		qglFogiv					= logFogiv;
		qglFrontFace				= logFrontFace;
		qglFrustum					= logFrustum;
		qglGenLists					= logGenLists;
		qglGenTextures				= logGenTextures;
		qglGetBooleanv				= logGetBooleanv;
		qglGetClipPlane				= logGetClipPlane;
		qglGetDoublev				= logGetDoublev;
		qglGetError					= logGetError;
		qglGetFloatv				= logGetFloatv;
		qglGetIntegerv				= logGetIntegerv;
		qglGetLightfv				= logGetLightfv;
		qglGetLightiv				= logGetLightiv;
		qglGetMapdv					= logGetMapdv;
		qglGetMapfv					= logGetMapfv;
		qglGetMapiv					= logGetMapiv;
		qglGetMaterialfv			= logGetMaterialfv;
		qglGetMaterialiv			= logGetMaterialiv;
		qglGetPixelMapfv			= logGetPixelMapfv;
		qglGetPixelMapuiv			= logGetPixelMapuiv;
		qglGetPixelMapusv			= logGetPixelMapusv;
		qglGetPointerv				= logGetPointerv;
		qglGetPolygonStipple		= logGetPolygonStipple;
		qglGetString				= logGetString;
		qglGetTexEnvfv				= logGetTexEnvfv;
		qglGetTexEnviv				= logGetTexEnviv;
		qglGetTexGendv				= logGetTexGendv;
		qglGetTexGenfv				= logGetTexGenfv;
		qglGetTexGeniv				= logGetTexGeniv;
		qglGetTexImage				= logGetTexImage;
		qglGetTexLevelParameterfv	= logGetTexLevelParameterfv;
		qglGetTexLevelParameteriv	= logGetTexLevelParameteriv;
		qglGetTexParameterfv		= logGetTexParameterfv;
		qglGetTexParameteriv		= logGetTexParameteriv;
		qglHint						= logHint;
		qglIndexMask				= logIndexMask;
		qglIndexPointer				= logIndexPointer;
		qglIndexd					= logIndexd;
		qglIndexdv					= logIndexdv;
		qglIndexf					= logIndexf;
		qglIndexfv					= logIndexfv;
		qglIndexi					= logIndexi;
		qglIndexiv					= logIndexiv;
		qglIndexs					= logIndexs;
		qglIndexsv					= logIndexsv;
		qglIndexub					= logIndexub;
		qglIndexubv					= logIndexubv;
		qglInitNames				= logInitNames;
		qglInterleavedArrays		= logInterleavedArrays;
		qglIsEnabled				= logIsEnabled;
		qglIsList					= logIsList;
		qglIsTexture				= logIsTexture;
		qglLightModelf				= logLightModelf;
		qglLightModelfv				= logLightModelfv;
		qglLightModeli				= logLightModeli;
		qglLightModeliv				= logLightModeliv;
		qglLightf					= logLightf;
		qglLightfv					= logLightfv;
		qglLighti					= logLighti;
		qglLightiv					= logLightiv;
		qglLineStipple				= logLineStipple;
		qglLineWidth				= logLineWidth;
		qglListBase					= logListBase;
		qglLoadIdentity				= logLoadIdentity;
		qglLoadMatrixd				= logLoadMatrixd;
		qglLoadMatrixf				= logLoadMatrixf;
		qglLoadName					= logLoadName;
		qglLogicOp					= logLogicOp;
		qglMap1d					= logMap1d;
		qglMap1f					= logMap1f;
		qglMap2d					= logMap2d;
		qglMap2f					= logMap2f;
		qglMapGrid1d				= logMapGrid1d;
		qglMapGrid1f				= logMapGrid1f;
		qglMapGrid2d				= logMapGrid2d;
		qglMapGrid2f				= logMapGrid2f;
		qglMaterialf				= logMaterialf;
		qglMaterialfv				= logMaterialfv;
		qglMateriali				= logMateriali;
		qglMaterialiv				= logMaterialiv;
		qglMatrixMode				= logMatrixMode;
		qglMultMatrixd				= logMultMatrixd;
		qglMultMatrixf				= logMultMatrixf;
		qglNewList					= logNewList;
		qglNormal3b					= logNormal3b;
		qglNormal3bv				= logNormal3bv;
		qglNormal3d					= logNormal3d;
		qglNormal3dv				= logNormal3dv;
		qglNormal3f					= logNormal3f;
		qglNormal3fv				= logNormal3fv;
		qglNormal3i					= logNormal3i;
		qglNormal3iv				= logNormal3iv;
		qglNormal3s					= logNormal3s;
		qglNormal3sv				= logNormal3sv;
		qglNormalPointer			= logNormalPointer;
		qglOrtho					= logOrtho;
		qglPassThrough				= logPassThrough;
		qglPixelMapfv				= logPixelMapfv;
		qglPixelMapuiv				= logPixelMapuiv;
		qglPixelMapusv				= logPixelMapusv;
		qglPixelStoref				= logPixelStoref;
		qglPixelStorei				= logPixelStorei;
		qglPixelTransferf			= logPixelTransferf;
		qglPixelTransferi			= logPixelTransferi;
		qglPixelZoom				= logPixelZoom;
		qglPointSize				= logPointSize;
		qglPolygonMode				= logPolygonMode;
		qglPolygonOffset			= logPolygonOffset;
		qglPolygonStipple			= logPolygonStipple;
		qglPopAttrib				= logPopAttrib;
		qglPopClientAttrib			= logPopClientAttrib;
		qglPopMatrix				= logPopMatrix;
		qglPopName					= logPopName;
		qglPrioritizeTextures		= logPrioritizeTextures;
		qglPushAttrib				= logPushAttrib;
		qglPushClientAttrib			= logPushClientAttrib;
		qglPushMatrix				= logPushMatrix;
		qglPushName					= logPushName;
		qglRasterPos2d				= logRasterPos2d;
		qglRasterPos2dv				= logRasterPos2dv;
		qglRasterPos2f				= logRasterPos2f;
		qglRasterPos2fv				= logRasterPos2fv;
		qglRasterPos2i				= logRasterPos2i;
		qglRasterPos2iv				= logRasterPos2iv;
		qglRasterPos2s				= logRasterPos2s;
		qglRasterPos2sv				= logRasterPos2sv;
		qglRasterPos3d				= logRasterPos3d;
		qglRasterPos3dv				= logRasterPos3dv;
		qglRasterPos3f				= logRasterPos3f;
		qglRasterPos3fv				= logRasterPos3fv;
		qglRasterPos3i				= logRasterPos3i;
		qglRasterPos3iv				= logRasterPos3iv;
		qglRasterPos3s				= logRasterPos3s;
		qglRasterPos3sv				= logRasterPos3sv;
		qglRasterPos4d				= logRasterPos4d;
		qglRasterPos4dv				= logRasterPos4dv;
		qglRasterPos4f				= logRasterPos4f;
		qglRasterPos4fv				= logRasterPos4fv;
		qglRasterPos4i				= logRasterPos4i;
		qglRasterPos4iv				= logRasterPos4iv;
		qglRasterPos4s				= logRasterPos4s;
		qglRasterPos4sv				= logRasterPos4sv;
		qglReadBuffer				= logReadBuffer;
		qglReadPixels				= logReadPixels;
		qglRectd					= logRectd;
		qglRectdv					= logRectdv;
		qglRectf					= logRectf;
		qglRectfv					= logRectfv;
		qglRecti					= logRecti;
		qglRectiv					= logRectiv;
		qglRects					= logRects;
		qglRectsv					= logRectsv;
		qglRenderMode				= logRenderMode;
		qglRotated					= logRotated;
		qglRotatef					= logRotatef;
		qglScaled					= logScaled;
		qglScalef					= logScalef;
		qglScissor					= logScissor;
		qglSelectBuffer				= logSelectBuffer;
		qglShadeModel				= logShadeModel;
		qglStencilFunc				= logStencilFunc;
		qglStencilMask				= logStencilMask;
		qglStencilOp				= logStencilOp;
		qglTexCoord1d				= logTexCoord1d;
		qglTexCoord1dv				= logTexCoord1dv;
		qglTexCoord1f				= logTexCoord1f;
		qglTexCoord1fv				= logTexCoord1fv;
		qglTexCoord1i				= logTexCoord1i;
		qglTexCoord1iv				= logTexCoord1iv;
		qglTexCoord1s				= logTexCoord1s;
		qglTexCoord1sv				= logTexCoord1sv;
		qglTexCoord2d				= logTexCoord2d;
		qglTexCoord2dv				= logTexCoord2dv;
		qglTexCoord2f				= logTexCoord2f;
		qglTexCoord2fv				= logTexCoord2fv;
		qglTexCoord2i				= logTexCoord2i;
		qglTexCoord2iv				= logTexCoord2iv;
		qglTexCoord2s				= logTexCoord2s;
		qglTexCoord2sv				= logTexCoord2sv;
		qglTexCoord3d				= logTexCoord3d;
		qglTexCoord3dv				= logTexCoord3dv;
		qglTexCoord3f				= logTexCoord3f;
		qglTexCoord3fv				= logTexCoord3fv;
		qglTexCoord3i				= logTexCoord3i;
		qglTexCoord3iv				= logTexCoord3iv;
		qglTexCoord3s				= logTexCoord3s;
		qglTexCoord3sv				= logTexCoord3sv;
		qglTexCoord4d				= logTexCoord4d;
		qglTexCoord4dv				= logTexCoord4dv;
		qglTexCoord4f				= logTexCoord4f;
		qglTexCoord4fv				= logTexCoord4fv;
		qglTexCoord4i				= logTexCoord4i;
		qglTexCoord4iv				= logTexCoord4iv;
		qglTexCoord4s				= logTexCoord4s;
		qglTexCoord4sv				= logTexCoord4sv;
		qglTexCoordPointer			= logTexCoordPointer;
		qglTexEnvf					= logTexEnvf;
		qglTexEnvfv					= logTexEnvfv;
		qglTexEnvi					= logTexEnvi;
		qglTexEnviv					= logTexEnviv;
		qglTexGend					= logTexGend;
		qglTexGendv					= logTexGendv;
		qglTexGenf					= logTexGenf;
		qglTexGenfv					= logTexGenfv;
		qglTexGeni					= logTexGeni;
		qglTexGeniv					= logTexGeniv;
		qglTexImage1D				= logTexImage1D;
		qglTexImage2D				= logTexImage2D;
		qglTexParameterf			= logTexParameterf;
		qglTexParameterfv			= logTexParameterfv;
		qglTexParameteri			= logTexParameteri;
		qglTexParameteriv			= logTexParameteriv;
		qglTexSubImage1D			= logTexSubImage1D;
		qglTexSubImage2D			= logTexSubImage2D;
		qglTranslated				= logTranslated;
		qglTranslatef				= logTranslatef;
		qglVertex2d					= logVertex2d;
		qglVertex2dv				= logVertex2dv;
		qglVertex2f					= logVertex2f;
		qglVertex2fv				= logVertex2fv;
		qglVertex2i					= logVertex2i;
		qglVertex2iv				= logVertex2iv;
		qglVertex2s					= logVertex2s;
		qglVertex2sv				= logVertex2sv;
		qglVertex3d					= logVertex3d;
		qglVertex3dv				= logVertex3dv;
		qglVertex3f					= logVertex3f;
		qglVertex3fv				= logVertex3fv;
		qglVertex3i					= logVertex3i;
		qglVertex3iv				= logVertex3iv;
		qglVertex3s					= logVertex3s;
		qglVertex3sv				= logVertex3sv;
		qglVertex4d					= logVertex4d;
		qglVertex4dv				= logVertex4dv;
		qglVertex4f					= logVertex4f;
		qglVertex4fv				= logVertex4fv;
		qglVertex4i					= logVertex4i;
		qglVertex4iv				= logVertex4iv;
		qglVertex4s					= logVertex4s;
		qglVertex4sv				= logVertex4sv;
		qglVertexPointer			= logVertexPointer;
		qglViewport					= logViewport;

		qglActiveTexture			= logActiveTexture;

		qglGenBuffers				= logGenBuffers;
		qglDeleteBuffers			= logDeleteBuffers;
		qglBindBuffer				= logBindBuffer;
		qglBufferData				= logBufferData;
		qglBufferSubData			= logBufferSubData;
		qglMapBuffer				= logMapBuffer;
		qglUnmapBuffer				= logUnmapBuffer;

		qglCreateShader				= logCreateShader;
		qglCreateProgram			= logCreateProgram;
		qglDeleteShader				= logDeleteShader;
		qglDeleteProgram			= logDeleteProgram;
		qglGetShaderiv				= logGetShaderiv;
		qglGetProgramiv				= logGetProgramiv;
		qglGetShaderInfoLog			= logGetShaderInfoLog;
		qglGetProgramInfoLog		= logGetProgramInfoLog;
		qglShaderSource				= logShaderSource;
		qglCompileShader			= logCompileShader;
		qglAttachShader				= logAttachShader;
		qglDetachShader				= logDetachShader;
		qglLinkProgram				= logLinkProgram;
		qglUseProgram				= logUseProgram;
		qglVertexAttribPointer		= logVertexAttribPointer;
		qglEnableVertexAttribArray	= logEnableVertexAttribArray;
		qglDisableVertexAttribArray	= logDisableVertexAttribArray;
		qglBindAttribLocation		= logBindAttribLocation;
		qglGetAttribLocation		= logGetAttribLocation;
		qglGetActiveUniform			= logGetActiveUniform;
		qglGetUniformLocation		= logGetUniformLocation;
		qglUniform1f				= logUniform1f;
		qglUniform2f				= logUniform2f;
		qglUniform3f				= logUniform3f;
		qglUniform4f				= logUniform4f;
		qglUniform1i				= logUniform1i;
		qglUniform2i				= logUniform2i;
		qglUniform3i				= logUniform3i;
		qglUniform4i				= logUniform4i;
		qglUniform1fv				= logUniform1fv;
		qglUniform2fv				= logUniform2fv;
		qglUniform3fv				= logUniform3fv;
		qglUniform4fv				= logUniform4fv;
		qglUniform1iv				= logUniform1iv;
		qglUniform2iv				= logUniform2iv;
		qglUniform3iv				= logUniform3iv;
		qglUniform4iv				= logUniform4iv;
		qglUniformMatrix2fv			= logUniformMatrix2fv;
		qglUniformMatrix3fv			= logUniformMatrix3fv;
		qglUniformMatrix4fv			= logUniformMatrix4fv;

		qglStencilFuncSeparate		= logStencilFuncSeparate;
		qglStencilOpSeparate		= logStencilOpSeparate;
		qglStencilMaskSeparate		= logStencilMaskSeparate;

		qglDepthBoundsEXT			= logDepthBoundsEXT;

		qwglSwapIntervalEXT			= logSwapIntervalEXT;
	}
	else {
		if (!qglState.logFile)
			return;

		Com_Printf("Closing log file '%s' after %i frames\n", qglState.logFileName, qglState.logFileFrames);

		time(&clock);
		curTime = localtime(&clock);

		fprintf(qglState.logFile, "\nLog file closed on %s\n\n", asctime(curTime));

		fclose(qglState.logFile);
		qglState.logFile = NULL;

		qglAccum					= dllAccum;
		qglAlphaFunc				= dllAlphaFunc;
		qglAreTexturesResident		= dllAreTexturesResident;
		qglArrayElement				= dllArrayElement;
		qglBegin					= dllBegin;
		qglBindTexture				= dllBindTexture;
		qglBitmap					= dllBitmap;
		qglBlendFunc				= dllBlendFunc;
		qglCallList					= dllCallList;
		qglCallLists				= dllCallLists;
		qglClear					= dllClear;
		qglClearAccum				= dllClearAccum;
		qglClearColor				= dllClearColor;
		qglClearDepth				= dllClearDepth;
		qglClearIndex				= dllClearIndex;
		qglClearStencil				= dllClearStencil;
		qglClipPlane				= dllClipPlane;
		qglColor3b					= dllColor3b;
		qglColor3bv					= dllColor3bv;
		qglColor3d					= dllColor3d;
		qglColor3dv					= dllColor3dv;
		qglColor3f					= dllColor3f;
		qglColor3fv					= dllColor3fv;
		qglColor3i					= dllColor3i;
		qglColor3iv					= dllColor3iv;
		qglColor3s					= dllColor3s;
		qglColor3sv					= dllColor3sv;
		qglColor3ub					= dllColor3ub;
		qglColor3ubv				= dllColor3ubv;
		qglColor3ui					= dllColor3ui;
		qglColor3uiv				= dllColor3uiv;
		qglColor3us					= dllColor3us;
		qglColor3usv				= dllColor3usv;
		qglColor4b					= dllColor4b;
		qglColor4bv					= dllColor4bv;
		qglColor4d					= dllColor4d;
		qglColor4dv					= dllColor4dv;
		qglColor4f					= dllColor4f;
		qglColor4fv					= dllColor4fv;
		qglColor4i					= dllColor4i;
		qglColor4iv					= dllColor4iv;
		qglColor4s					= dllColor4s;
		qglColor4sv					= dllColor4sv;
		qglColor4ub					= dllColor4ub;
		qglColor4ubv				= dllColor4ubv;
		qglColor4ui					= dllColor4ui;
		qglColor4uiv				= dllColor4uiv;
		qglColor4us					= dllColor4us;
		qglColor4usv				= dllColor4usv;
		qglColorMask				= dllColorMask;
		qglColorMaterial			= dllColorMaterial;
		qglColorPointer				= dllColorPointer;
		qglCopyPixels				= dllCopyPixels;
		qglCopyTexImage1D			= dllCopyTexImage1D;
		qglCopyTexImage2D			= dllCopyTexImage2D;
		qglCopyTexSubImage1D		= dllCopyTexSubImage1D;
		qglCopyTexSubImage2D		= dllCopyTexSubImage2D;
		qglCullFace					= dllCullFace;
		qglDeleteLists				= dllDeleteLists;
		qglDeleteTextures			= dllDeleteTextures;
		qglDepthFunc				= dllDepthFunc;
		qglDepthMask				= dllDepthMask;
		qglDepthRange				= dllDepthRange;
		qglDisable					= dllDisable;
		qglDisableClientState		= dllDisableClientState;
		qglDrawArrays				= dllDrawArrays;
		qglDrawBuffer				= dllDrawBuffer;
		qglDrawElements				= dllDrawElements;
		qglDrawPixels				= dllDrawPixels;
		qglEdgeFlag					= dllEdgeFlag;
		qglEdgeFlagPointer			= dllEdgeFlagPointer;
		qglEdgeFlagv				= dllEdgeFlagv;
		qglEnable					= dllEnable;
		qglEnableClientState		= dllEnableClientState;
		qglEnd						= dllEnd;
		qglEndList					= dllEndList;
		qglEvalCoord1d				= dllEvalCoord1d;
		qglEvalCoord1dv				= dllEvalCoord1dv;
		qglEvalCoord1f				= dllEvalCoord1f;
		qglEvalCoord1fv				= dllEvalCoord1fv;
		qglEvalCoord2d				= dllEvalCoord2d;
		qglEvalCoord2dv				= dllEvalCoord2dv;
		qglEvalCoord2f				= dllEvalCoord2f;
		qglEvalCoord2fv				= dllEvalCoord2fv;
		qglEvalMesh1				= dllEvalMesh1;
		qglEvalMesh2				= dllEvalMesh2;
		qglEvalPoint1				= dllEvalPoint1;
		qglEvalPoint2				= dllEvalPoint2;
		qglFeedbackBuffer			= dllFeedbackBuffer;
		qglFinish					= dllFinish;
		qglFlush					= dllFlush;
		qglFogf						= dllFogf;
		qglFogfv					= dllFogfv;
		qglFogi						= dllFogi;
		qglFogiv					= dllFogiv;
		qglFrontFace				= dllFrontFace;
		qglFrustum					= dllFrustum;
		qglGenLists					= dllGenLists;
		qglGenTextures				= dllGenTextures;
		qglGetBooleanv				= dllGetBooleanv;
		qglGetClipPlane				= dllGetClipPlane;
		qglGetDoublev				= dllGetDoublev;
		qglGetError					= dllGetError;
		qglGetFloatv				= dllGetFloatv;
		qglGetIntegerv				= dllGetIntegerv;
		qglGetLightfv				= dllGetLightfv;
		qglGetLightiv				= dllGetLightiv;
		qglGetMapdv					= dllGetMapdv;
		qglGetMapfv					= dllGetMapfv;
		qglGetMapiv					= dllGetMapiv;
		qglGetMaterialfv			= dllGetMaterialfv;
		qglGetMaterialiv			= dllGetMaterialiv;
		qglGetPixelMapfv			= dllGetPixelMapfv;
		qglGetPixelMapuiv			= dllGetPixelMapuiv;
		qglGetPixelMapusv			= dllGetPixelMapusv;
		qglGetPointerv				= dllGetPointerv;
		qglGetPolygonStipple		= dllGetPolygonStipple;
		qglGetString				= dllGetString;
		qglGetTexEnvfv				= dllGetTexEnvfv;
		qglGetTexEnviv				= dllGetTexEnviv;
		qglGetTexGendv				= dllGetTexGendv;
		qglGetTexGenfv				= dllGetTexGenfv;
		qglGetTexGeniv				= dllGetTexGeniv;
		qglGetTexImage				= dllGetTexImage;
		qglGetTexLevelParameterfv	= dllGetTexLevelParameterfv;
		qglGetTexLevelParameteriv	= dllGetTexLevelParameteriv;
		qglGetTexParameterfv		= dllGetTexParameterfv;
		qglGetTexParameteriv		= dllGetTexParameteriv;
		qglHint						= dllHint;
		qglIndexMask				= dllIndexMask;
		qglIndexPointer				= dllIndexPointer;
		qglIndexd					= dllIndexd;
		qglIndexdv					= dllIndexdv;
		qglIndexf					= dllIndexf;
		qglIndexfv					= dllIndexfv;
		qglIndexi					= dllIndexi;
		qglIndexiv					= dllIndexiv;
		qglIndexs					= dllIndexs;
		qglIndexsv					= dllIndexsv;
		qglIndexub					= dllIndexub;
		qglIndexubv					= dllIndexubv;
		qglInitNames				= dllInitNames;
		qglInterleavedArrays		= dllInterleavedArrays;
		qglIsEnabled				= dllIsEnabled;
		qglIsList					= dllIsList;
		qglIsTexture				= dllIsTexture;
		qglLightModelf				= dllLightModelf;
		qglLightModelfv				= dllLightModelfv;
		qglLightModeli				= dllLightModeli;
		qglLightModeliv				= dllLightModeliv;
		qglLightf					= dllLightf;
		qglLightfv					= dllLightfv;
		qglLighti					= dllLighti;
		qglLightiv					= dllLightiv;
		qglLineStipple				= dllLineStipple;
		qglLineWidth				= dllLineWidth;
		qglListBase					= dllListBase;
		qglLoadIdentity				= dllLoadIdentity;
		qglLoadMatrixd				= dllLoadMatrixd;
		qglLoadMatrixf				= dllLoadMatrixf;
		qglLoadName					= dllLoadName;
		qglLogicOp					= dllLogicOp;
		qglMap1d					= dllMap1d;
		qglMap1f					= dllMap1f;
		qglMap2d					= dllMap2d;
		qglMap2f					= dllMap2f;
		qglMapGrid1d				= dllMapGrid1d;
		qglMapGrid1f				= dllMapGrid1f;
		qglMapGrid2d				= dllMapGrid2d;
		qglMapGrid2f				= dllMapGrid2f;
		qglMaterialf				= dllMaterialf;
		qglMaterialfv				= dllMaterialfv;
		qglMateriali				= dllMateriali;
		qglMaterialiv				= dllMaterialiv;
		qglMatrixMode				= dllMatrixMode;
		qglMultMatrixd				= dllMultMatrixd;
		qglMultMatrixf				= dllMultMatrixf;
		qglNewList					= dllNewList;
		qglNormal3b					= dllNormal3b;
		qglNormal3bv				= dllNormal3bv;
		qglNormal3d					= dllNormal3d;
		qglNormal3dv				= dllNormal3dv;
		qglNormal3f					= dllNormal3f;
		qglNormal3fv				= dllNormal3fv;
		qglNormal3i					= dllNormal3i;
		qglNormal3iv				= dllNormal3iv;
		qglNormal3s					= dllNormal3s;
		qglNormal3sv				= dllNormal3sv;
		qglNormalPointer			= dllNormalPointer;
		qglOrtho					= dllOrtho;
		qglPassThrough				= dllPassThrough;
		qglPixelMapfv				= dllPixelMapfv;
		qglPixelMapuiv				= dllPixelMapuiv;
		qglPixelMapusv				= dllPixelMapusv;
		qglPixelStoref				= dllPixelStoref;
		qglPixelStorei				= dllPixelStorei;
		qglPixelTransferf			= dllPixelTransferf;
		qglPixelTransferi			= dllPixelTransferi;
		qglPixelZoom				= dllPixelZoom;
		qglPointSize				= dllPointSize;
		qglPolygonMode				= dllPolygonMode;
		qglPolygonOffset			= dllPolygonOffset;
		qglPolygonStipple			= dllPolygonStipple;
		qglPopAttrib				= dllPopAttrib;
		qglPopClientAttrib			= dllPopClientAttrib;
		qglPopMatrix				= dllPopMatrix;
		qglPopName					= dllPopName;
		qglPrioritizeTextures		= dllPrioritizeTextures;
		qglPushAttrib				= dllPushAttrib;
		qglPushClientAttrib			= dllPushClientAttrib;
		qglPushMatrix				= dllPushMatrix;
		qglPushName					= dllPushName;
		qglRasterPos2d				= dllRasterPos2d;
		qglRasterPos2dv				= dllRasterPos2dv;
		qglRasterPos2f				= dllRasterPos2f;
		qglRasterPos2fv				= dllRasterPos2fv;
		qglRasterPos2i				= dllRasterPos2i;
		qglRasterPos2iv				= dllRasterPos2iv;
		qglRasterPos2s				= dllRasterPos2s;
		qglRasterPos2sv				= dllRasterPos2sv;
		qglRasterPos3d				= dllRasterPos3d;
		qglRasterPos3dv				= dllRasterPos3dv;
		qglRasterPos3f				= dllRasterPos3f;
		qglRasterPos3fv				= dllRasterPos3fv;
		qglRasterPos3i				= dllRasterPos3i;
		qglRasterPos3iv				= dllRasterPos3iv;
		qglRasterPos3s				= dllRasterPos3s;
		qglRasterPos3sv				= dllRasterPos3sv;
		qglRasterPos4d				= dllRasterPos4d;
		qglRasterPos4dv				= dllRasterPos4dv;
		qglRasterPos4f				= dllRasterPos4f;
		qglRasterPos4fv				= dllRasterPos4fv;
		qglRasterPos4i				= dllRasterPos4i;
		qglRasterPos4iv				= dllRasterPos4iv;
		qglRasterPos4s				= dllRasterPos4s;
		qglRasterPos4sv				= dllRasterPos4sv;
		qglReadBuffer				= dllReadBuffer;
		qglReadPixels				= dllReadPixels;
		qglRectd					= dllRectd;
		qglRectdv					= dllRectdv;
		qglRectf					= dllRectf;
		qglRectfv					= dllRectfv;
		qglRecti					= dllRecti;
		qglRectiv					= dllRectiv;
		qglRects					= dllRects;
		qglRectsv					= dllRectsv;
		qglRenderMode				= dllRenderMode;
		qglRotated					= dllRotated;
		qglRotatef					= dllRotatef;
		qglScaled					= dllScaled;
		qglScalef					= dllScalef;
		qglScissor					= dllScissor;
		qglSelectBuffer				= dllSelectBuffer;
		qglShadeModel				= dllShadeModel;
		qglStencilFunc				= dllStencilFunc;
		qglStencilMask				= dllStencilMask;
		qglStencilOp				= dllStencilOp;
		qglTexCoord1d				= dllTexCoord1d;
		qglTexCoord1dv				= dllTexCoord1dv;
		qglTexCoord1f				= dllTexCoord1f;
		qglTexCoord1fv				= dllTexCoord1fv;
		qglTexCoord1i				= dllTexCoord1i;
		qglTexCoord1iv				= dllTexCoord1iv;
		qglTexCoord1s				= dllTexCoord1s;
		qglTexCoord1sv				= dllTexCoord1sv;
		qglTexCoord2d				= dllTexCoord2d;
		qglTexCoord2dv				= dllTexCoord2dv;
		qglTexCoord2f				= dllTexCoord2f;
		qglTexCoord2fv				= dllTexCoord2fv;
		qglTexCoord2i				= dllTexCoord2i;
		qglTexCoord2iv				= dllTexCoord2iv;
		qglTexCoord2s				= dllTexCoord2s;
		qglTexCoord2sv				= dllTexCoord2sv;
		qglTexCoord3d				= dllTexCoord3d;
		qglTexCoord3dv				= dllTexCoord3dv;
		qglTexCoord3f				= dllTexCoord3f;
		qglTexCoord3fv				= dllTexCoord3fv;
		qglTexCoord3i				= dllTexCoord3i;
		qglTexCoord3iv				= dllTexCoord3iv;
		qglTexCoord3s				= dllTexCoord3s;
		qglTexCoord3sv				= dllTexCoord3sv;
		qglTexCoord4d				= dllTexCoord4d;
		qglTexCoord4dv				= dllTexCoord4dv;
		qglTexCoord4f				= dllTexCoord4f;
		qglTexCoord4fv				= dllTexCoord4fv;
		qglTexCoord4i				= dllTexCoord4i;
		qglTexCoord4iv				= dllTexCoord4iv;
		qglTexCoord4s				= dllTexCoord4s;
		qglTexCoord4sv				= dllTexCoord4sv;
		qglTexCoordPointer			= dllTexCoordPointer;
		qglTexEnvf					= dllTexEnvf;
		qglTexEnvfv					= dllTexEnvfv;
		qglTexEnvi					= dllTexEnvi;
		qglTexEnviv					= dllTexEnviv;
		qglTexGend					= dllTexGend;
		qglTexGendv					= dllTexGendv;
		qglTexGenf					= dllTexGenf;
		qglTexGenfv					= dllTexGenfv;
		qglTexGeni					= dllTexGeni;
		qglTexGeniv					= dllTexGeniv;
		qglTexImage1D				= dllTexImage1D;
		qglTexImage2D				= dllTexImage2D;
		qglTexParameterf			= dllTexParameterf;
		qglTexParameterfv			= dllTexParameterfv;
		qglTexParameteri			= dllTexParameteri;
		qglTexParameteriv			= dllTexParameteriv;
		qglTexSubImage1D			= dllTexSubImage1D;
		qglTexSubImage2D			= dllTexSubImage2D;
		qglTranslated				= dllTranslated;
		qglTranslatef				= dllTranslatef;
		qglVertex2d					= dllVertex2d;
		qglVertex2dv				= dllVertex2dv;
		qglVertex2f					= dllVertex2f;
		qglVertex2fv				= dllVertex2fv;
		qglVertex2i					= dllVertex2i;
		qglVertex2iv				= dllVertex2iv;
		qglVertex2s					= dllVertex2s;
		qglVertex2sv				= dllVertex2sv;
		qglVertex3d					= dllVertex3d;
		qglVertex3dv				= dllVertex3dv;
		qglVertex3f					= dllVertex3f;
		qglVertex3fv				= dllVertex3fv;
		qglVertex3i					= dllVertex3i;
		qglVertex3iv				= dllVertex3iv;
		qglVertex3s					= dllVertex3s;
		qglVertex3sv				= dllVertex3sv;
		qglVertex4d					= dllVertex4d;
		qglVertex4dv				= dllVertex4dv;
		qglVertex4f					= dllVertex4f;
		qglVertex4fv				= dllVertex4fv;
		qglVertex4i					= dllVertex4i;
		qglVertex4iv				= dllVertex4iv;
		qglVertex4s					= dllVertex4s;
		qglVertex4sv				= dllVertex4sv;
		qglVertexPointer			= dllVertexPointer;
		qglViewport					= dllViewport;

		qglActiveTexture			= dllActiveTexture;

		qglGenBuffers				= dllGenBuffers;
		qglDeleteBuffers			= dllDeleteBuffers;
		qglBindBuffer				= dllBindBuffer;
		qglBufferData				= dllBufferData;
		qglBufferSubData			= dllBufferSubData;
		qglMapBuffer				= dllMapBuffer;
		qglUnmapBuffer				= dllUnmapBuffer;

		qglCreateShader				= dllCreateShader;
		qglCreateProgram			= dllCreateProgram;
		qglDeleteShader				= dllDeleteShader;
		qglDeleteProgram			= dllDeleteProgram;
		qglGetShaderiv				= dllGetShaderiv;
		qglGetProgramiv				= dllGetProgramiv;
		qglGetShaderInfoLog			= dllGetShaderInfoLog;
		qglGetProgramInfoLog		= dllGetProgramInfoLog;
		qglShaderSource				= dllShaderSource;
		qglCompileShader			= dllCompileShader;
		qglAttachShader				= dllAttachShader;
		qglDetachShader				= dllDetachShader;
		qglLinkProgram				= dllLinkProgram;
		qglUseProgram				= dllUseProgram;
		qglVertexAttribPointer		= dllVertexAttribPointer;
		qglEnableVertexAttribArray	= dllEnableVertexAttribArray;
		qglDisableVertexAttribArray	= dllDisableVertexAttribArray;
		qglBindAttribLocation		= dllBindAttribLocation;
		qglGetAttribLocation		= dllGetAttribLocation;
		qglGetActiveUniform			= dllGetActiveUniform;
		qglGetUniformLocation		= dllGetUniformLocation;
		qglUniform1f				= dllUniform1f;
		qglUniform2f				= dllUniform2f;
		qglUniform3f				= dllUniform3f;
		qglUniform4f				= dllUniform4f;
		qglUniform1i				= dllUniform1i;
		qglUniform2i				= dllUniform2i;
		qglUniform3i				= dllUniform3i;
		qglUniform4i				= dllUniform4i;
		qglUniform1fv				= dllUniform1fv;
		qglUniform2fv				= dllUniform2fv;
		qglUniform3fv				= dllUniform3fv;
		qglUniform4fv				= dllUniform4fv;
		qglUniform1iv				= dllUniform1iv;
		qglUniform2iv				= dllUniform2iv;
		qglUniform3iv				= dllUniform3iv;
		qglUniform4iv				= dllUniform4iv;
		qglUniformMatrix2fv			= dllUniformMatrix2fv;
		qglUniformMatrix3fv			= dllUniformMatrix3fv;
		qglUniformMatrix4fv			= dllUniformMatrix4fv;

		qglStencilFuncSeparate		= dllStencilFuncSeparate;
		qglStencilOpSeparate		= dllStencilOpSeparate;
		qglStencilMaskSeparate		= dllStencilMaskSeparate;

		qglDepthBoundsEXT			= dllDepthBoundsEXT;

		qwglSwapIntervalEXT			= dllSwapIntervalEXT;
	}
}

/*
 ==================
 QGL_LogPrintf
 ==================
*/
void QGL_LogPrintf (const char *fmt, ...){

	va_list	argPtr;

	if (!qglState.logFile)
		return;

	va_start(argPtr, fmt);
	vfprintf(qglState.logFile, fmt, argPtr);
	va_end(argPtr);
}

/*
 ==================
 QGL_GetProcAddress
 ==================
*/
static void *QGL_GetProcAddress (const char *procName){

	void	*procAddress;

	procAddress = (void*)GetProcAddress(qglState.hModule, procName);
	if (!procAddress){
		FreeLibrary(qglState.hModule);
		qglState.hModule = NULL;

		Com_Error(true, "QGL_GetProcAddress: GetProcAddress() failed for '%s'", procName);
	}

	return procAddress;
}

/*
 ==================
 QGL_Init

 Binds our QGL function pointers to the appropriate GL stuff
 ==================
*/
bool QGL_Init (const char *driver){

	char	systemDir[MAX_OSPATH];
	char	path[MAX_OSPATH];

	Com_Printf("...initializing QGL\n");

	if (driver[0] != '!'){
		if (GetSystemDirectory(systemDir, sizeof(systemDir)))
			Str_SPrintf(path, sizeof(path), "%s\\%s.dll", systemDir, driver);
		else
			Str_SPrintf(path, sizeof(path), "%s.dll", driver);
	}
	else
		Str_SPrintf(path, sizeof(path), "%s.dll", &driver[1]);

	Com_Printf("...calling LoadLibrary( '%s' ): ", path);
	if ((qglState.hModule = LoadLibrary(path)) == NULL){
		Com_Printf("failed\n");
		return false;
	}
	Com_Printf("succeeded\n");

	qwglChoosePixelFormat		= (WGLCHOOSEPIXELFORMAT)QGL_GetProcAddress("wglChoosePixelFormat");
	qwglCopyContext				= (WGLCOPYCONTEXT)QGL_GetProcAddress("wglCopyContext");
	qwglCreateContext			= (WGLCREATECONTEXT)QGL_GetProcAddress("wglCreateContext");
	qwglCreateLayerContext		= (WGLCREATELAYERCONTEXT)QGL_GetProcAddress("wglCreateLayerContext");
	qwglDeleteContext			= (WGLDELETECONTEXT)QGL_GetProcAddress("wglDeleteContext");
	qwglDescribeLayerPlane		= (WGLDESCRIBELAYERPLANE)QGL_GetProcAddress("wglDescribeLayerPlane");
	qwglDescribePixelFormat		= (WGLDESCRIBEPIXELFORMAT)QGL_GetProcAddress("wglDescribePixelFormat");
	qwglGetCurrentContext		= (WGLGETCURRENTCONTEXT)QGL_GetProcAddress("wglGetCurrentContext");
	qwglGetCurrentDC			= (WGLGETCURRENTDC)QGL_GetProcAddress("wglGetCurrentDC");
	qwglGetLayerPaletteEntries	= (WGLGETLAYERPALETTEENTRIES)QGL_GetProcAddress("wglGetLayerPaletteEntries");
	qwglGetPixelFormat			= (WGLGETPIXELFORMAT)QGL_GetProcAddress("wglGetPixelFormat");
	qwglGetProcAddress			= (WGLGETPROCADDRESS)QGL_GetProcAddress("wglGetProcAddress");
	qwglMakeCurrent				= (WGLMAKECURRENT)QGL_GetProcAddress("wglMakeCurrent");
	qwglRealizeLayerPalette		= (WGLREALIZELAYERPALETTE)QGL_GetProcAddress("wglRealizeLayerPalette");
	qwglSetLayerPaletteEntries	= (WGLSETLAYERPALETTEENTRIES)QGL_GetProcAddress("wglSetLayerPaletteEntries");
	qwglSetPixelFormat			= (WGLSETPIXELFORMAT)QGL_GetProcAddress("wglSetPixelFormat");
	qwglShareLists				= (WGLSHARELISTS)QGL_GetProcAddress("wglShareLists");
	qwglSwapBuffers				= (WGLSWAPBUFFERS)QGL_GetProcAddress("wglSwapBuffers");
	qwglSwapLayerBuffers		= (WGLSWAPLAYERBUFFERS)QGL_GetProcAddress("wglSwapLayerBuffers");
	qwglUseFontBitmaps			= (WGLUSEFONTBITMAPS)QGL_GetProcAddress("wglUseFontBitmapsA");
	qwglUseFontOutlines			= (WGLUSEFONTOUTLINES)QGL_GetProcAddress("wglUseFontOutlinesA");

	qglAccum					= dllAccum						= (GLACCUM)QGL_GetProcAddress("glAccum");
	qglAlphaFunc				= dllAlphaFunc					= (GLALPHAFUNC)QGL_GetProcAddress("glAlphaFunc");
	qglAreTexturesResident		= dllAreTexturesResident		= (GLARETEXTURESRESIDENT)QGL_GetProcAddress("glAreTexturesResident");
	qglArrayElement				= dllArrayElement				= (GLARRAYELEMENT)QGL_GetProcAddress("glArrayElement");
	qglBegin					= dllBegin						= (GLBEGIN)QGL_GetProcAddress("glBegin");
	qglBindTexture				= dllBindTexture				= (GLBINDTEXTURE)QGL_GetProcAddress("glBindTexture");
	qglBitmap					= dllBitmap						= (GLBITMAP)QGL_GetProcAddress("glBitmap");
	qglBlendFunc				= dllBlendFunc					= (GLBLENDFUNC)QGL_GetProcAddress("glBlendFunc");
	qglCallList					= dllCallList					= (GLCALLLIST)QGL_GetProcAddress("glCallList");
	qglCallLists				= dllCallLists					= (GLCALLLISTS)QGL_GetProcAddress("glCallLists");
	qglClear					= dllClear						= (GLCLEAR)QGL_GetProcAddress("glClear");
	qglClearAccum				= dllClearAccum					= (GLCLEARACCUM)QGL_GetProcAddress("glClearAccum");
	qglClearColor				= dllClearColor					= (GLCLEARCOLOR)QGL_GetProcAddress("glClearColor");
	qglClearDepth				= dllClearDepth					= (GLCLEARDEPTH)QGL_GetProcAddress("glClearDepth");
	qglClearIndex				= dllClearIndex					= (GLCLEARINDEX)QGL_GetProcAddress("glClearIndex");
	qglClearStencil				= dllClearStencil				= (GLCLEARSTENCIL)QGL_GetProcAddress("glClearStencil");
	qglClipPlane				= dllClipPlane					= (GLCLIPPLANE)QGL_GetProcAddress("glClipPlane");
	qglColor3b					= dllColor3b					= (GLCOLOR3B)QGL_GetProcAddress("glColor3b");
	qglColor3bv					= dllColor3bv					= (GLCOLOR3BV)QGL_GetProcAddress("glColor3bv");
	qglColor3d					= dllColor3d					= (GLCOLOR3D)QGL_GetProcAddress("glColor3d");
	qglColor3dv					= dllColor3dv					= (GLCOLOR3DV)QGL_GetProcAddress("glColor3dv");
	qglColor3f					= dllColor3f					= (GLCOLOR3F)QGL_GetProcAddress("glColor3f");
	qglColor3fv					= dllColor3fv					= (GLCOLOR3FV)QGL_GetProcAddress("glColor3fv");
	qglColor3i					= dllColor3i					= (GLCOLOR3I)QGL_GetProcAddress("glColor3i");
	qglColor3iv					= dllColor3iv					= (GLCOLOR3IV)QGL_GetProcAddress("glColor3iv");
	qglColor3s					= dllColor3s					= (GLCOLOR3S)QGL_GetProcAddress("glColor3s");
	qglColor3sv					= dllColor3sv					= (GLCOLOR3SV)QGL_GetProcAddress("glColor3sv");
	qglColor3ub					= dllColor3ub					= (GLCOLOR3UB)QGL_GetProcAddress("glColor3ub");
	qglColor3ubv				= dllColor3ubv					= (GLCOLOR3UBV)QGL_GetProcAddress("glColor3ubv");
	qglColor3ui					= dllColor3ui					= (GLCOLOR3UI)QGL_GetProcAddress("glColor3ui");
	qglColor3uiv				= dllColor3uiv					= (GLCOLOR3UIV)QGL_GetProcAddress("glColor3uiv");
	qglColor3us					= dllColor3us					= (GLCOLOR3US)QGL_GetProcAddress("glColor3us");
	qglColor3usv				= dllColor3usv					= (GLCOLOR3USV)QGL_GetProcAddress("glColor3usv");
	qglColor4b					= dllColor4b					= (GLCOLOR4B)QGL_GetProcAddress("glColor4b");
	qglColor4bv					= dllColor4bv					= (GLCOLOR4BV)QGL_GetProcAddress("glColor4bv");
	qglColor4d					= dllColor4d					= (GLCOLOR4D)QGL_GetProcAddress("glColor4d");
	qglColor4dv					= dllColor4dv					= (GLCOLOR4DV)QGL_GetProcAddress("glColor4dv");
	qglColor4f					= dllColor4f					= (GLCOLOR4F)QGL_GetProcAddress("glColor4f");
	qglColor4fv					= dllColor4fv					= (GLCOLOR4FV)QGL_GetProcAddress("glColor4fv");
	qglColor4i					= dllColor4i					= (GLCOLOR4I)QGL_GetProcAddress("glColor4i");
	qglColor4iv					= dllColor4iv					= (GLCOLOR4IV)QGL_GetProcAddress("glColor4iv");
	qglColor4s					= dllColor4s					= (GLCOLOR4S)QGL_GetProcAddress("glColor4s");
	qglColor4sv					= dllColor4sv					= (GLCOLOR4SV)QGL_GetProcAddress("glColor4sv");
	qglColor4ub					= dllColor4ub					= (GLCOLOR4UB)QGL_GetProcAddress("glColor4ub");
	qglColor4ubv				= dllColor4ubv					= (GLCOLOR4UBV)QGL_GetProcAddress("glColor4ubv");
	qglColor4ui					= dllColor4ui					= (GLCOLOR4UI)QGL_GetProcAddress("glColor4ui");
	qglColor4uiv				= dllColor4uiv					= (GLCOLOR4UIV)QGL_GetProcAddress("glColor4uiv");
	qglColor4us					= dllColor4us					= (GLCOLOR4US)QGL_GetProcAddress("glColor4us");
	qglColor4usv				= dllColor4usv					= (GLCOLOR4USV)QGL_GetProcAddress("glColor4usv");
	qglColorMask				= dllColorMask					= (GLCOLORMASK)QGL_GetProcAddress("glColorMask");
	qglColorMaterial			= dllColorMaterial				= (GLCOLORMATERIAL)QGL_GetProcAddress("glColorMaterial");
	qglColorPointer				= dllColorPointer				= (GLCOLORPOINTER)QGL_GetProcAddress("glColorPointer");
	qglCopyPixels				= dllCopyPixels					= (GLCOPYPIXELS)QGL_GetProcAddress("glCopyPixels");
	qglCopyTexImage1D			= dllCopyTexImage1D				= (GLCOPYTEXIMAGE1D)QGL_GetProcAddress("glCopyTexImage1D");
	qglCopyTexImage2D			= dllCopyTexImage2D				= (GLCOPYTEXIMAGE2D)QGL_GetProcAddress("glCopyTexImage2D");
	qglCopyTexSubImage1D		= dllCopyTexSubImage1D			= (GLCOPYTEXSUBIMAGE1D)QGL_GetProcAddress("glCopyTexSubImage1D");
	qglCopyTexSubImage2D		= dllCopyTexSubImage2D			= (GLCOPYTEXSUBIMAGE2D)QGL_GetProcAddress("glCopyTexSubImage2D");
	qglCullFace					= dllCullFace					= (GLCULLFACE)QGL_GetProcAddress("glCullFace");
	qglDeleteLists				= dllDeleteLists				= (GLDELETELISTS)QGL_GetProcAddress("glDeleteLists");
	qglDeleteTextures			= dllDeleteTextures				= (GLDELETETEXTURES)QGL_GetProcAddress("glDeleteTextures");
	qglDepthFunc				= dllDepthFunc					= (GLDEPTHFUNC)QGL_GetProcAddress("glDepthFunc");
	qglDepthMask				= dllDepthMask					= (GLDEPTHMASK)QGL_GetProcAddress("glDepthMask");
	qglDepthRange				= dllDepthRange					= (GLDEPTHRANGE)QGL_GetProcAddress("glDepthRange");
	qglDisable					= dllDisable					= (GLDISABLE)QGL_GetProcAddress("glDisable");
	qglDisableClientState		= dllDisableClientState			= (GLDISABLECLIENTSTATE)QGL_GetProcAddress("glDisableClientState");
	qglDrawArrays				= dllDrawArrays					= (GLDRAWARRAYS)QGL_GetProcAddress("glDrawArrays");
	qglDrawBuffer				= dllDrawBuffer					= (GLDRAWBUFFER)QGL_GetProcAddress("glDrawBuffer");
	qglDrawElements				= dllDrawElements				= (GLDRAWELEMENTS)QGL_GetProcAddress("glDrawElements");
	qglDrawPixels				= dllDrawPixels					= (GLDRAWPIXELS)QGL_GetProcAddress("glDrawPixels");
	qglEdgeFlag					= dllEdgeFlag					= (GLEDGEFLAG)QGL_GetProcAddress("glEdgeFlag");
	qglEdgeFlagPointer			= dllEdgeFlagPointer			= (GLEDGEFLAGPOINTER)QGL_GetProcAddress("glEdgeFlagPointer");
	qglEdgeFlagv				= dllEdgeFlagv					= (GLEDGEFLAGV)QGL_GetProcAddress("glEdgeFlagv");
	qglEnable					= dllEnable						= (GLENABLE)QGL_GetProcAddress("glEnable");
	qglEnableClientState		= dllEnableClientState			= (GLENABLECLIENTSTATE)QGL_GetProcAddress("glEnableClientState");
	qglEnd						= dllEnd						= (GLEND)QGL_GetProcAddress("glEnd");
	qglEndList					= dllEndList					= (GLENDLIST)QGL_GetProcAddress("glEndList");
	qglEvalCoord1d				= dllEvalCoord1d				= (GLEVALCOORD1D)QGL_GetProcAddress("glEvalCoord1d");
	qglEvalCoord1dv				= dllEvalCoord1dv				= (GLEVALCOORD1DV)QGL_GetProcAddress("glEvalCoord1dv");
	qglEvalCoord1f				= dllEvalCoord1f				= (GLEVALCOORD1F)QGL_GetProcAddress("glEvalCoord1f");
	qglEvalCoord1fv				= dllEvalCoord1fv				= (GLEVALCOORD1FV)QGL_GetProcAddress("glEvalCoord1fv");
	qglEvalCoord2d				= dllEvalCoord2d				= (GLEVALCOORD2D)QGL_GetProcAddress("glEvalCoord2d");
	qglEvalCoord2dv				= dllEvalCoord2dv				= (GLEVALCOORD2DV)QGL_GetProcAddress("glEvalCoord2dv");
	qglEvalCoord2f				= dllEvalCoord2f				= (GLEVALCOORD2F)QGL_GetProcAddress("glEvalCoord2f");
	qglEvalCoord2fv				= dllEvalCoord2fv				= (GLEVALCOORD2FV)QGL_GetProcAddress("glEvalCoord2fv");
	qglEvalMesh1				= dllEvalMesh1					= (GLEVALMESH1)QGL_GetProcAddress("glEvalMesh1");
	qglEvalMesh2				= dllEvalMesh2					= (GLEVALMESH2)QGL_GetProcAddress("glEvalMesh2");
	qglEvalPoint1				= dllEvalPoint1					= (GLEVALPOINT1)QGL_GetProcAddress("glEvalPoint1");
	qglEvalPoint2				= dllEvalPoint2					= (GLEVALPOINT2)QGL_GetProcAddress("glEvalPoint2");
	qglFeedbackBuffer			= dllFeedbackBuffer				= (GLFEEDBACKBUFFER)QGL_GetProcAddress("glFeedbackBuffer");
	qglFinish					= dllFinish						= (GLFINISH)QGL_GetProcAddress("glFinish");
	qglFlush					= dllFlush						= (GLFLUSH)QGL_GetProcAddress("glFlush");
	qglFogf						= dllFogf						= (GLFOGF)QGL_GetProcAddress("glFogf");
	qglFogfv					= dllFogfv						= (GLFOGFV)QGL_GetProcAddress("glFogfv");
	qglFogi						= dllFogi						= (GLFOGI)QGL_GetProcAddress("glFogi");
	qglFogiv					= dllFogiv						= (GLFOGIV)QGL_GetProcAddress("glFogiv");
	qglFrontFace				= dllFrontFace					= (GLFRONTFACE)QGL_GetProcAddress("glFrontFace");
	qglFrustum					= dllFrustum					= (GLFRUSTUM)QGL_GetProcAddress("glFrustum");
	qglGenLists					= dllGenLists					= (GLGENLISTS)QGL_GetProcAddress("glGenLists");
	qglGenTextures				= dllGenTextures				= (GLGENTEXTURES)QGL_GetProcAddress("glGenTextures");
	qglGetBooleanv				= dllGetBooleanv				= (GLGETBOOLEANV)QGL_GetProcAddress("glGetBooleanv");
	qglGetClipPlane				= dllGetClipPlane				= (GLGETCLIPPLANE)QGL_GetProcAddress("glGetClipPlane");
	qglGetDoublev				= dllGetDoublev					= (GLGETDOUBLEV)QGL_GetProcAddress("glGetDoublev");
	qglGetError					= dllGetError					= (GLGETERROR)QGL_GetProcAddress("glGetError");
	qglGetFloatv				= dllGetFloatv					= (GLGETFLOATV)QGL_GetProcAddress("glGetFloatv");
	qglGetIntegerv				= dllGetIntegerv				= (GLGETINTEGERV)QGL_GetProcAddress("glGetIntegerv");
	qglGetLightfv				= dllGetLightfv					= (GLGETLIGHTFV)QGL_GetProcAddress("glGetLightfv");
	qglGetLightiv				= dllGetLightiv					= (GLGETLIGHTIV)QGL_GetProcAddress("glGetLightiv");
	qglGetMapdv					= dllGetMapdv					= (GLGETMAPDV)QGL_GetProcAddress("glGetMapdv");
	qglGetMapfv					= dllGetMapfv					= (GLGETMAPFV)QGL_GetProcAddress("glGetMapfv");
	qglGetMapiv					= dllGetMapiv					= (GLGETMAPIV)QGL_GetProcAddress("glGetMapiv");
	qglGetMaterialfv			= dllGetMaterialfv				= (GLGETMATERIALFV)QGL_GetProcAddress("glGetMaterialfv");
	qglGetMaterialiv			= dllGetMaterialiv				= (GLGETMATERIALIV)QGL_GetProcAddress("glGetMaterialiv");
	qglGetPixelMapfv			= dllGetPixelMapfv				= (GLGETPIXELMAPFV)QGL_GetProcAddress("glGetPixelMapfv");
	qglGetPixelMapuiv			= dllGetPixelMapuiv				= (GLGETPIXELMAPUIV)QGL_GetProcAddress("glGetPixelMapuiv");
	qglGetPixelMapusv			= dllGetPixelMapusv				= (GLGETPIXELMAPUSV)QGL_GetProcAddress("glGetPixelMapusv");
	qglGetPointerv				= dllGetPointerv				= (GLGETPOINTERV)QGL_GetProcAddress("glGetPointerv");
	qglGetPolygonStipple		= dllGetPolygonStipple			= (GLGETPOLYGONSTIPPLE)QGL_GetProcAddress("glGetPolygonStipple");
	qglGetString				= dllGetString					= (GLGETSTRING)QGL_GetProcAddress("glGetString");
	qglGetTexEnvfv				= dllGetTexEnvfv				= (GLGETTEXENVFV)QGL_GetProcAddress("glGetTexEnvfv");
	qglGetTexEnviv				= dllGetTexEnviv				= (GLGETTEXENVIV)QGL_GetProcAddress("glGetTexEnviv");
	qglGetTexGendv				= dllGetTexGendv				= (GLGETTEXGENDV)QGL_GetProcAddress("glGetTexGendv");
	qglGetTexGenfv				= dllGetTexGenfv				= (GLGETTEXGENFV)QGL_GetProcAddress("glGetTexGenfv");
	qglGetTexGeniv				= dllGetTexGeniv				= (GLGETTEXGENIV)QGL_GetProcAddress("glGetTexGeniv");
	qglGetTexImage				= dllGetTexImage				= (GLGETTEXIMAGE)QGL_GetProcAddress("glGetTexImage");
	qglGetTexLevelParameterfv	= dllGetTexLevelParameterfv		= (GLGETTEXLEVELPARAMETERFV)QGL_GetProcAddress("glGetTexLevelParameterfv");
	qglGetTexLevelParameteriv	= dllGetTexLevelParameteriv		= (GLGETTEXLEVELPARAMETERIV)QGL_GetProcAddress("glGetTexLevelParameteriv");
	qglGetTexParameterfv		= dllGetTexParameterfv			= (GLGETTEXPARAMETERFV)QGL_GetProcAddress("glGetTexParameterfv");
	qglGetTexParameteriv		= dllGetTexParameteriv			= (GLGETTEXPARAMETERIV)QGL_GetProcAddress("glGetTexParameteriv");
	qglHint						= dllHint						= (GLHINT)QGL_GetProcAddress("glHint");
	qglIndexMask				= dllIndexMask					= (GLINDEXMASK)QGL_GetProcAddress("glIndexMask");
	qglIndexPointer				= dllIndexPointer				= (GLINDEXPOINTER)QGL_GetProcAddress("glIndexPointer");
	qglIndexd					= dllIndexd						= (GLINDEXD)QGL_GetProcAddress("glIndexd");
	qglIndexdv					= dllIndexdv					= (GLINDEXDV)QGL_GetProcAddress("glIndexdv");
	qglIndexf					= dllIndexf						= (GLINDEXF)QGL_GetProcAddress("glIndexf");
	qglIndexfv					= dllIndexfv					= (GLINDEXFV)QGL_GetProcAddress("glIndexfv");
	qglIndexi					= dllIndexi						= (GLINDEXI)QGL_GetProcAddress("glIndexi");
	qglIndexiv					= dllIndexiv					= (GLINDEXIV)QGL_GetProcAddress("glIndexiv");
	qglIndexs					= dllIndexs						= (GLINDEXS)QGL_GetProcAddress("glIndexs");
	qglIndexsv					= dllIndexsv					= (GLINDEXSV)QGL_GetProcAddress("glIndexsv");
	qglIndexub					= dllIndexub					= (GLINDEXUB)QGL_GetProcAddress("glIndexub");
	qglIndexubv					= dllIndexubv					= (GLINDEXUBV)QGL_GetProcAddress("glIndexubv");
	qglInitNames				= dllInitNames					= (GLINITNAMES)QGL_GetProcAddress("glInitNames");
	qglInterleavedArrays		= dllInterleavedArrays			= (GLINTERLEAVEDARRAYS)QGL_GetProcAddress("glInterleavedArrays");
	qglIsEnabled				= dllIsEnabled					= (GLISENABLED)QGL_GetProcAddress("glIsEnabled");
	qglIsList					= dllIsList						= (GLISLIST)QGL_GetProcAddress("glIsList");
	qglIsTexture				= dllIsTexture					= (GLISTEXTURE)QGL_GetProcAddress("glIsTexture");
	qglLightModelf				= dllLightModelf				= (GLLIGHTMODELF)QGL_GetProcAddress("glLightModelf");
	qglLightModelfv				= dllLightModelfv				= (GLLIGHTMODELFV)QGL_GetProcAddress("glLightModelfv");
	qglLightModeli				= dllLightModeli				= (GLLIGHTMODELI)QGL_GetProcAddress("glLightModeli");
	qglLightModeliv				= dllLightModeliv				= (GLLIGHTMODELIV)QGL_GetProcAddress("glLightModeliv");
	qglLightf					= dllLightf						= (GLLIGHTF)QGL_GetProcAddress("glLightf");
	qglLightfv					= dllLightfv					= (GLLIGHTFV)QGL_GetProcAddress("glLightfv");
	qglLighti					= dllLighti						= (GLLIGHTI)QGL_GetProcAddress("glLighti");
	qglLightiv					= dllLightiv					= (GLLIGHTIV)QGL_GetProcAddress("glLightiv");
	qglLineStipple				= dllLineStipple				= (GLLINESTIPPLE)QGL_GetProcAddress("glLineStipple");
	qglLineWidth				= dllLineWidth					= (GLLINEWIDTH)QGL_GetProcAddress("glLineWidth");
	qglListBase					= dllListBase					= (GLLISTBASE)QGL_GetProcAddress("glListBase");
	qglLoadIdentity				= dllLoadIdentity				= (GLLOADIDENTITY)QGL_GetProcAddress("glLoadIdentity");
	qglLoadMatrixd				= dllLoadMatrixd				= (GLLOADMATRIXD)QGL_GetProcAddress("glLoadMatrixd");
	qglLoadMatrixf				= dllLoadMatrixf				= (GLLOADMATRIXF)QGL_GetProcAddress("glLoadMatrixf");
	qglLoadName					= dllLoadName					= (GLLOADNAME)QGL_GetProcAddress("glLoadName");
	qglLogicOp					= dllLogicOp					= (GLLOGICOP)QGL_GetProcAddress("glLogicOp");
	qglMap1d					= dllMap1d						= (GLMAP1D)QGL_GetProcAddress("glMap1d");
	qglMap1f					= dllMap1f						= (GLMAP1F)QGL_GetProcAddress("glMap1f");
	qglMap2d					= dllMap2d						= (GLMAP2D)QGL_GetProcAddress("glMap2d");
	qglMap2f					= dllMap2f						= (GLMAP2F)QGL_GetProcAddress("glMap2f");
	qglMapGrid1d				= dllMapGrid1d					= (GLMAPGRID1D)QGL_GetProcAddress("glMapGrid1d");
	qglMapGrid1f				= dllMapGrid1f					= (GLMAPGRID1F)QGL_GetProcAddress("glMapGrid1f");
	qglMapGrid2d				= dllMapGrid2d					= (GLMAPGRID2D)QGL_GetProcAddress("glMapGrid2d");
	qglMapGrid2f				= dllMapGrid2f					= (GLMAPGRID2F)QGL_GetProcAddress("glMapGrid2f");
	qglMaterialf				= dllMaterialf					= (GLMATERIALF)QGL_GetProcAddress("glMaterialf");
	qglMaterialfv				= dllMaterialfv					= (GLMATERIALFV)QGL_GetProcAddress("glMaterialfv");
	qglMateriali				= dllMateriali					= (GLMATERIALI)QGL_GetProcAddress("glMateriali");
	qglMaterialiv				= dllMaterialiv					= (GLMATERIALIV)QGL_GetProcAddress("glMaterialiv");
	qglMatrixMode				= dllMatrixMode					= (GLMATRIXMODE)QGL_GetProcAddress("glMatrixMode");
	qglMultMatrixd				= dllMultMatrixd				= (GLMULTMATRIXD)QGL_GetProcAddress("glMultMatrixd");
	qglMultMatrixf				= dllMultMatrixf				= (GLMULTMATRIXF)QGL_GetProcAddress("glMultMatrixf");
	qglNewList					= dllNewList					= (GLNEWLIST)QGL_GetProcAddress("glNewList");
	qglNormal3b					= dllNormal3b					= (GLNORMAL3B)QGL_GetProcAddress("glNormal3b");
	qglNormal3bv				= dllNormal3bv					= (GLNORMAL3BV)QGL_GetProcAddress("glNormal3bv");
	qglNormal3d					= dllNormal3d					= (GLNORMAL3D)QGL_GetProcAddress("glNormal3d");
	qglNormal3dv				= dllNormal3dv					= (GLNORMAL3DV)QGL_GetProcAddress("glNormal3dv");
	qglNormal3f					= dllNormal3f					= (GLNORMAL3F)QGL_GetProcAddress("glNormal3f");
	qglNormal3fv				= dllNormal3fv					= (GLNORMAL3FV)QGL_GetProcAddress("glNormal3fv");
	qglNormal3i					= dllNormal3i					= (GLNORMAL3I)QGL_GetProcAddress("glNormal3i");
	qglNormal3iv				= dllNormal3iv					= (GLNORMAL3IV)QGL_GetProcAddress("glNormal3iv");
	qglNormal3s					= dllNormal3s					= (GLNORMAL3S)QGL_GetProcAddress("glNormal3s");
	qglNormal3sv				= dllNormal3sv					= (GLNORMAL3SV)QGL_GetProcAddress("glNormal3sv");
	qglNormalPointer			= dllNormalPointer				= (GLNORMALPOINTER)QGL_GetProcAddress("glNormalPointer");
	qglOrtho					= dllOrtho						= (GLORTHO)QGL_GetProcAddress("glOrtho");
	qglPassThrough				= dllPassThrough				= (GLPASSTHROUGH)QGL_GetProcAddress("glPassThrough");
	qglPixelMapfv				= dllPixelMapfv					= (GLPIXELMAPFV)QGL_GetProcAddress("glPixelMapfv");
	qglPixelMapuiv				= dllPixelMapuiv				= (GLPIXELMAPUIV)QGL_GetProcAddress("glPixelMapuiv");
	qglPixelMapusv				= dllPixelMapusv				= (GLPIXELMAPUSV)QGL_GetProcAddress("glPixelMapusv");
	qglPixelStoref				= dllPixelStoref				= (GLPIXELSTOREF)QGL_GetProcAddress("glPixelStoref");
	qglPixelStorei				= dllPixelStorei				= (GLPIXELSTOREI)QGL_GetProcAddress("glPixelStorei");
	qglPixelTransferf			= dllPixelTransferf				= (GLPIXELTRANSFERF)QGL_GetProcAddress("glPixelTransferf");
	qglPixelTransferi			= dllPixelTransferi				= (GLPIXELTRANSFERI)QGL_GetProcAddress("glPixelTransferi");
	qglPixelZoom				= dllPixelZoom					= (GLPIXELZOOM)QGL_GetProcAddress("glPixelZoom");
	qglPointSize				= dllPointSize					= (GLPOINTSIZE)QGL_GetProcAddress("glPointSize");
	qglPolygonMode				= dllPolygonMode				= (GLPOLYGONMODE)QGL_GetProcAddress("glPolygonMode");
	qglPolygonOffset			= dllPolygonOffset				= (GLPOLYGONOFFSET)QGL_GetProcAddress("glPolygonOffset");
	qglPolygonStipple			= dllPolygonStipple				= (GLPOLYGONSTIPPLE)QGL_GetProcAddress("glPolygonStipple");
	qglPopAttrib				= dllPopAttrib					= (GLPOPATTRIB)QGL_GetProcAddress("glPopAttrib");
	qglPopClientAttrib			= dllPopClientAttrib			= (GLPOPCLIENTATTRIB)QGL_GetProcAddress("glPopClientAttrib");
	qglPopMatrix				= dllPopMatrix					= (GLPOPMATRIX)QGL_GetProcAddress("glPopMatrix");
	qglPopName					= dllPopName					= (GLPOPNAME)QGL_GetProcAddress("glPopName");
	qglPrioritizeTextures		= dllPrioritizeTextures			= (GLPRIORITIZETEXTURES)QGL_GetProcAddress("glPrioritizeTextures");
	qglPushAttrib				= dllPushAttrib					= (GLPUSHATTRIB)QGL_GetProcAddress("glPushAttrib");
	qglPushClientAttrib			= dllPushClientAttrib			= (GLPUSHCLIENTATTRIB)QGL_GetProcAddress("glPushClientAttrib");
	qglPushMatrix				= dllPushMatrix					= (GLPUSHMATRIX)QGL_GetProcAddress("glPushMatrix");
	qglPushName					= dllPushName					= (GLPUSHNAME)QGL_GetProcAddress("glPushName");
	qglRasterPos2d				= dllRasterPos2d				= (GLRASTERPOS2D)QGL_GetProcAddress("glRasterPos2d");
	qglRasterPos2dv				= dllRasterPos2dv				= (GLRASTERPOS2DV)QGL_GetProcAddress("glRasterPos2dv");
	qglRasterPos2f				= dllRasterPos2f				= (GLRASTERPOS2F)QGL_GetProcAddress("glRasterPos2f");
	qglRasterPos2fv				= dllRasterPos2fv				= (GLRASTERPOS2FV)QGL_GetProcAddress("glRasterPos2fv");
	qglRasterPos2i				= dllRasterPos2i				= (GLRASTERPOS2I)QGL_GetProcAddress("glRasterPos2i");
	qglRasterPos2iv				= dllRasterPos2iv				= (GLRASTERPOS2IV)QGL_GetProcAddress("glRasterPos2iv");
	qglRasterPos2s				= dllRasterPos2s				= (GLRASTERPOS2S)QGL_GetProcAddress("glRasterPos2s");
	qglRasterPos2sv				= dllRasterPos2sv				= (GLRASTERPOS2SV)QGL_GetProcAddress("glRasterPos2sv");
	qglRasterPos3d				= dllRasterPos3d				= (GLRASTERPOS3D)QGL_GetProcAddress("glRasterPos3d");
	qglRasterPos3dv				= dllRasterPos3dv				= (GLRASTERPOS3DV)QGL_GetProcAddress("glRasterPos3dv");
	qglRasterPos3f				= dllRasterPos3f				= (GLRASTERPOS3F)QGL_GetProcAddress("glRasterPos3f");
	qglRasterPos3fv				= dllRasterPos3fv				= (GLRASTERPOS3FV)QGL_GetProcAddress("glRasterPos3fv");
	qglRasterPos3i				= dllRasterPos3i				= (GLRASTERPOS3I)QGL_GetProcAddress("glRasterPos3i");
	qglRasterPos3iv				= dllRasterPos3iv				= (GLRASTERPOS3IV)QGL_GetProcAddress("glRasterPos3iv");
	qglRasterPos3s				= dllRasterPos3s				= (GLRASTERPOS3S)QGL_GetProcAddress("glRasterPos3s");
	qglRasterPos3sv				= dllRasterPos3sv				= (GLRASTERPOS3SV)QGL_GetProcAddress("glRasterPos3sv");
	qglRasterPos4d				= dllRasterPos4d				= (GLRASTERPOS4D)QGL_GetProcAddress("glRasterPos4d");
	qglRasterPos4dv				= dllRasterPos4dv				= (GLRASTERPOS4DV)QGL_GetProcAddress("glRasterPos4dv");
	qglRasterPos4f				= dllRasterPos4f				= (GLRASTERPOS4F)QGL_GetProcAddress("glRasterPos4f");
	qglRasterPos4fv				= dllRasterPos4fv				= (GLRASTERPOS4FV)QGL_GetProcAddress("glRasterPos4fv");
	qglRasterPos4i				= dllRasterPos4i				= (GLRASTERPOS4I)QGL_GetProcAddress("glRasterPos4i");
	qglRasterPos4iv				= dllRasterPos4iv				= (GLRASTERPOS4IV)QGL_GetProcAddress("glRasterPos4iv");
	qglRasterPos4s				= dllRasterPos4s				= (GLRASTERPOS4S)QGL_GetProcAddress("glRasterPos4s");
	qglRasterPos4sv				= dllRasterPos4sv				= (GLRASTERPOS4SV)QGL_GetProcAddress("glRasterPos4sv");
	qglReadBuffer				= dllReadBuffer					= (GLREADBUFFER)QGL_GetProcAddress("glReadBuffer");
	qglReadPixels				= dllReadPixels					= (GLREADPIXELS)QGL_GetProcAddress("glReadPixels");
	qglRectd					= dllRectd						= (GLRECTD)QGL_GetProcAddress("glRectd");
	qglRectdv					= dllRectdv						= (GLRECTDV)QGL_GetProcAddress("glRectdv");
	qglRectf					= dllRectf						= (GLRECTF)QGL_GetProcAddress("glRectf");
	qglRectfv					= dllRectfv						= (GLRECTFV)QGL_GetProcAddress("glRectfv");
	qglRecti					= dllRecti						= (GLRECTI)QGL_GetProcAddress("glRecti");
	qglRectiv					= dllRectiv						= (GLRECTIV)QGL_GetProcAddress("glRectiv");
	qglRects					= dllRects						= (GLRECTS)QGL_GetProcAddress("glRects");
	qglRectsv					= dllRectsv						= (GLRECTSV)QGL_GetProcAddress("glRectsv");
	qglRenderMode				= dllRenderMode					= (GLRENDERMODE)QGL_GetProcAddress("glRenderMode");
	qglRotated					= dllRotated					= (GLROTATED)QGL_GetProcAddress("glRotated");
	qglRotatef					= dllRotatef					= (GLROTATEF)QGL_GetProcAddress("glRotatef");
	qglScaled					= dllScaled						= (GLSCALED)QGL_GetProcAddress("glScaled");
	qglScalef					= dllScalef						= (GLSCALEF)QGL_GetProcAddress("glScalef");
	qglScissor					= dllScissor					= (GLSCISSOR)QGL_GetProcAddress("glScissor");
	qglSelectBuffer				= dllSelectBuffer				= (GLSELECTBUFFER)QGL_GetProcAddress("glSelectBuffer");
	qglShadeModel				= dllShadeModel					= (GLSHADEMODEL)QGL_GetProcAddress("glShadeModel");
	qglStencilFunc				= dllStencilFunc				= (GLSTENCILFUNC)QGL_GetProcAddress("glStencilFunc");
	qglStencilMask				= dllStencilMask				= (GLSTENCILMASK)QGL_GetProcAddress("glStencilMask");
	qglStencilOp				= dllStencilOp					= (GLSTENCILOP)QGL_GetProcAddress("glStencilOp");
	qglTexCoord1d				= dllTexCoord1d					= (GLTEXCOORD1D)QGL_GetProcAddress("glTexCoord1d");
	qglTexCoord1dv				= dllTexCoord1dv				= (GLTEXCOORD1DV)QGL_GetProcAddress("glTexCoord1dv");
	qglTexCoord1f				= dllTexCoord1f					= (GLTEXCOORD1F)QGL_GetProcAddress("glTexCoord1f");
	qglTexCoord1fv				= dllTexCoord1fv				= (GLTEXCOORD1FV)QGL_GetProcAddress("glTexCoord1fv");
	qglTexCoord1i				= dllTexCoord1i					= (GLTEXCOORD1I)QGL_GetProcAddress("glTexCoord1i");
	qglTexCoord1iv				= dllTexCoord1iv				= (GLTEXCOORD1IV)QGL_GetProcAddress("glTexCoord1iv");
	qglTexCoord1s				= dllTexCoord1s					= (GLTEXCOORD1S)QGL_GetProcAddress("glTexCoord1s");
	qglTexCoord1sv				= dllTexCoord1sv				= (GLTEXCOORD1SV)QGL_GetProcAddress("glTexCoord1sv");
	qglTexCoord2d				= dllTexCoord2d					= (GLTEXCOORD2D)QGL_GetProcAddress("glTexCoord2d");
	qglTexCoord2dv				= dllTexCoord2dv				= (GLTEXCOORD2DV)QGL_GetProcAddress("glTexCoord2dv");
	qglTexCoord2f				= dllTexCoord2f					= (GLTEXCOORD2F)QGL_GetProcAddress("glTexCoord2f");
	qglTexCoord2fv				= dllTexCoord2fv				= (GLTEXCOORD2FV)QGL_GetProcAddress("glTexCoord2fv");
	qglTexCoord2i				= dllTexCoord2i					= (GLTEXCOORD2I)QGL_GetProcAddress("glTexCoord2i");
	qglTexCoord2iv				= dllTexCoord2iv				= (GLTEXCOORD2IV)QGL_GetProcAddress("glTexCoord2iv");
	qglTexCoord2s				= dllTexCoord2s					= (GLTEXCOORD2S)QGL_GetProcAddress("glTexCoord2s");
	qglTexCoord2sv				= dllTexCoord2sv				= (GLTEXCOORD2SV)QGL_GetProcAddress("glTexCoord2sv");
	qglTexCoord3d				= dllTexCoord3d					= (GLTEXCOORD3D)QGL_GetProcAddress("glTexCoord3d");
	qglTexCoord3dv				= dllTexCoord3dv				= (GLTEXCOORD3DV)QGL_GetProcAddress("glTexCoord3dv");
	qglTexCoord3f				= dllTexCoord3f					= (GLTEXCOORD3F)QGL_GetProcAddress("glTexCoord3f");
	qglTexCoord3fv				= dllTexCoord3fv				= (GLTEXCOORD3FV)QGL_GetProcAddress("glTexCoord3fv");
	qglTexCoord3i				= dllTexCoord3i					= (GLTEXCOORD3I)QGL_GetProcAddress("glTexCoord3i");
	qglTexCoord3iv				= dllTexCoord3iv				= (GLTEXCOORD3IV)QGL_GetProcAddress("glTexCoord3iv");
	qglTexCoord3s				= dllTexCoord3s					= (GLTEXCOORD3S)QGL_GetProcAddress("glTexCoord3s");
	qglTexCoord3sv				= dllTexCoord3sv				= (GLTEXCOORD3SV)QGL_GetProcAddress("glTexCoord3sv");
	qglTexCoord4d				= dllTexCoord4d					= (GLTEXCOORD4D)QGL_GetProcAddress("glTexCoord4d");
	qglTexCoord4dv				= dllTexCoord4dv				= (GLTEXCOORD4DV)QGL_GetProcAddress("glTexCoord4dv");
	qglTexCoord4f				= dllTexCoord4f					= (GLTEXCOORD4F)QGL_GetProcAddress("glTexCoord4f");
	qglTexCoord4fv				= dllTexCoord4fv				= (GLTEXCOORD4FV)QGL_GetProcAddress("glTexCoord4fv");
	qglTexCoord4i				= dllTexCoord4i					= (GLTEXCOORD4I)QGL_GetProcAddress("glTexCoord4i");
	qglTexCoord4iv				= dllTexCoord4iv				= (GLTEXCOORD4IV)QGL_GetProcAddress("glTexCoord4iv");
	qglTexCoord4s				= dllTexCoord4s					= (GLTEXCOORD4S)QGL_GetProcAddress("glTexCoord4s");
	qglTexCoord4sv				= dllTexCoord4sv				= (GLTEXCOORD4SV)QGL_GetProcAddress("glTexCoord4sv");
	qglTexCoordPointer			= dllTexCoordPointer			= (GLTEXCOORDPOINTER)QGL_GetProcAddress("glTexCoordPointer");
	qglTexEnvf					= dllTexEnvf					= (GLTEXENVF)QGL_GetProcAddress("glTexEnvf");
	qglTexEnvfv					= dllTexEnvfv					= (GLTEXENVFV)QGL_GetProcAddress("glTexEnvfv");
	qglTexEnvi					= dllTexEnvi					= (GLTEXENVI)QGL_GetProcAddress("glTexEnvi");
	qglTexEnviv					= dllTexEnviv					= (GLTEXENVIV)QGL_GetProcAddress("glTexEnviv");
	qglTexGend					= dllTexGend					= (GLTEXGEND)QGL_GetProcAddress("glTexGend");
	qglTexGendv					= dllTexGendv					= (GLTEXGENDV)QGL_GetProcAddress("glTexGendv");
	qglTexGenf					= dllTexGenf					= (GLTEXGENF)QGL_GetProcAddress("glTexGenf");
	qglTexGenfv					= dllTexGenfv					= (GLTEXGENFV)QGL_GetProcAddress("glTexGenfv");
	qglTexGeni					= dllTexGeni					= (GLTEXGENI)QGL_GetProcAddress("glTexGeni");
	qglTexGeniv					= dllTexGeniv					= (GLTEXGENIV)QGL_GetProcAddress("glTexGeniv");
	qglTexImage1D				= dllTexImage1D					= (GLTEXIMAGE1D)QGL_GetProcAddress("glTexImage1D");
	qglTexImage2D				= dllTexImage2D					= (GLTEXIMAGE2D)QGL_GetProcAddress("glTexImage2D");
	qglTexParameterf			= dllTexParameterf				= (GLTEXPARAMETERF)QGL_GetProcAddress("glTexParameterf");
	qglTexParameterfv			= dllTexParameterfv				= (GLTEXPARAMETERFV)QGL_GetProcAddress("glTexParameterfv");
	qglTexParameteri			= dllTexParameteri				= (GLTEXPARAMETERI)QGL_GetProcAddress("glTexParameteri");
	qglTexParameteriv			= dllTexParameteriv				= (GLTEXPARAMETERIV)QGL_GetProcAddress("glTexParameteriv");
	qglTexSubImage1D			= dllTexSubImage1D				= (GLTEXSUBIMAGE1D)QGL_GetProcAddress("glTexSubImage1D");
	qglTexSubImage2D			= dllTexSubImage2D				= (GLTEXSUBIMAGE2D)QGL_GetProcAddress("glTexSubImage2D");
	qglTranslated				= dllTranslated					= (GLTRANSLATED)QGL_GetProcAddress("glTranslated");
	qglTranslatef				= dllTranslatef					= (GLTRANSLATEF)QGL_GetProcAddress("glTranslatef");
	qglVertex2d					= dllVertex2d					= (GLVERTEX2D)QGL_GetProcAddress("glVertex2d");
	qglVertex2dv				= dllVertex2dv					= (GLVERTEX2DV)QGL_GetProcAddress("glVertex2dv");
	qglVertex2f					= dllVertex2f					= (GLVERTEX2F)QGL_GetProcAddress("glVertex2f");
	qglVertex2fv				= dllVertex2fv					= (GLVERTEX2FV)QGL_GetProcAddress("glVertex2fv");
	qglVertex2i					= dllVertex2i					= (GLVERTEX2I)QGL_GetProcAddress("glVertex2i");
	qglVertex2iv				= dllVertex2iv					= (GLVERTEX2IV)QGL_GetProcAddress("glVertex2iv");
	qglVertex2s					= dllVertex2s					= (GLVERTEX2S)QGL_GetProcAddress("glVertex2s");
	qglVertex2sv				= dllVertex2sv					= (GLVERTEX2SV)QGL_GetProcAddress("glVertex2sv");
	qglVertex3d					= dllVertex3d					= (GLVERTEX3D)QGL_GetProcAddress("glVertex3d");
	qglVertex3dv				= dllVertex3dv					= (GLVERTEX3DV)QGL_GetProcAddress("glVertex3dv");
	qglVertex3f					= dllVertex3f					= (GLVERTEX3F)QGL_GetProcAddress("glVertex3f");
	qglVertex3fv				= dllVertex3fv					= (GLVERTEX3FV)QGL_GetProcAddress("glVertex3fv");
	qglVertex3i					= dllVertex3i					= (GLVERTEX3I)QGL_GetProcAddress("glVertex3i");
	qglVertex3iv				= dllVertex3iv					= (GLVERTEX3IV)QGL_GetProcAddress("glVertex3iv");
	qglVertex3s					= dllVertex3s					= (GLVERTEX3S)QGL_GetProcAddress("glVertex3s");
	qglVertex3sv				= dllVertex3sv					= (GLVERTEX3SV)QGL_GetProcAddress("glVertex3sv");
	qglVertex4d					= dllVertex4d					= (GLVERTEX4D)QGL_GetProcAddress("glVertex4d");
	qglVertex4dv				= dllVertex4dv					= (GLVERTEX4DV)QGL_GetProcAddress("glVertex4dv");
	qglVertex4f					= dllVertex4f					= (GLVERTEX4F)QGL_GetProcAddress("glVertex4f");
	qglVertex4fv				= dllVertex4fv					= (GLVERTEX4FV)QGL_GetProcAddress("glVertex4fv");
	qglVertex4i					= dllVertex4i					= (GLVERTEX4I)QGL_GetProcAddress("glVertex4i");
	qglVertex4iv				= dllVertex4iv					= (GLVERTEX4IV)QGL_GetProcAddress("glVertex4iv");
	qglVertex4s					= dllVertex4s					= (GLVERTEX4S)QGL_GetProcAddress("glVertex4s");
	qglVertex4sv				= dllVertex4sv					= (GLVERTEX4SV)QGL_GetProcAddress("glVertex4sv");
	qglVertexPointer			= dllVertexPointer				= (GLVERTEXPOINTER)QGL_GetProcAddress("glVertexPointer");
	qglViewport					= dllViewport					= (GLVIEWPORT)QGL_GetProcAddress("glViewport");

	qglActiveTexture			= dllActiveTexture				= NULL;

	qglGenBuffers				= dllGenBuffers					= NULL;
	qglDeleteBuffers			= dllDeleteBuffers				= NULL;
	qglBindBuffer				= dllBindBuffer					= NULL;
	qglBufferData				= dllBufferData					= NULL;
	qglBufferSubData			= dllBufferSubData				= NULL;
	qglMapBuffer				= dllMapBuffer					= NULL;
	qglUnmapBuffer				= dllUnmapBuffer				= NULL;

	qglCreateShader				= dllCreateShader				= NULL;
	qglCreateProgram			= dllCreateProgram				= NULL;
	qglDeleteShader				= dllDeleteShader				= NULL;
	qglDeleteProgram			= dllDeleteProgram				= NULL;
	qglGetShaderiv				= dllGetShaderiv				= NULL;
	qglGetProgramiv				= dllGetProgramiv				= NULL;
	qglGetShaderInfoLog			= dllGetShaderInfoLog			= NULL;
	qglGetProgramInfoLog		= dllGetProgramInfoLog			= NULL;
	qglShaderSource				= dllShaderSource				= NULL;
	qglCompileShader			= dllCompileShader				= NULL;
	qglAttachShader				= dllAttachShader				= NULL;
	qglDetachShader				= dllDetachShader				= NULL;
	qglLinkProgram				= dllLinkProgram				= NULL;
	qglUseProgram				= dllUseProgram					= NULL;
	qglVertexAttribPointer		= dllVertexAttribPointer		= NULL;
	qglEnableVertexAttribArray	= dllEnableVertexAttribArray	= NULL;
	qglDisableVertexAttribArray	= dllDisableVertexAttribArray	= NULL;
	qglBindAttribLocation		= dllBindAttribLocation			= NULL;
	qglGetAttribLocation		= dllGetAttribLocation			= NULL;
	qglGetActiveUniform			= dllGetActiveUniform			= NULL;
	qglGetUniformLocation		= dllGetUniformLocation			= NULL;
	qglUniform1f				= dllUniform1f					= NULL;
	qglUniform2f				= dllUniform2f					= NULL;
	qglUniform3f				= dllUniform3f					= NULL;
	qglUniform4f				= dllUniform4f					= NULL;
	qglUniform1i				= dllUniform1i					= NULL;
	qglUniform2i				= dllUniform2i					= NULL;
	qglUniform3i				= dllUniform3i					= NULL;
	qglUniform4i				= dllUniform4i					= NULL;
	qglUniform1fv				= dllUniform1fv					= NULL;
	qglUniform2fv				= dllUniform2fv					= NULL;
	qglUniform3fv				= dllUniform3fv					= NULL;
	qglUniform4fv				= dllUniform4fv					= NULL;
	qglUniform1iv				= dllUniform1iv					= NULL;
	qglUniform2iv				= dllUniform2iv					= NULL;
	qglUniform3iv				= dllUniform3iv					= NULL;
	qglUniform4iv				= dllUniform4iv					= NULL;
	qglUniformMatrix2fv			= dllUniformMatrix2fv			= NULL;
	qglUniformMatrix3fv			= dllUniformMatrix3fv			= NULL;
	qglUniformMatrix4fv			= dllUniformMatrix4fv			= NULL;

	qglStencilFuncSeparate		= dllStencilFuncSeparate		= NULL;
	qglStencilOpSeparate		= dllStencilOpSeparate			= NULL;
	qglStencilMaskSeparate		= dllStencilMaskSeparate		= NULL;

	qglDepthBoundsEXT			= dllDepthBoundsEXT				= NULL;

	qwglSwapIntervalEXT			= dllSwapIntervalEXT			= NULL;

	return true;
}

/*
 ==================
 QGL_Shutdown

 Unloads the specified DLL then nulls out all the proc pointers
 ==================
*/
void QGL_Shutdown (void){

	Com_Printf("...shutting down QGL\n");

	if (qglState.logFile){
		fclose(qglState.logFile);
		qglState.logFile = NULL;
	}

	if (qglState.hModule){
		Com_Printf("...unloading OpenGL DLL\n");

		FreeLibrary(qglState.hModule);
		qglState.hModule = NULL;
	}

	memset(&qglState, 0, sizeof(qglState_t));

	qwglChoosePixelFormat		= NULL;
	qwglCopyContext				= NULL;
	qwglCreateContext			= NULL;
	qwglCreateLayerContext		= NULL;
	qwglDeleteContext			= NULL;
	qwglDescribeLayerPlane		= NULL;
	qwglDescribePixelFormat		= NULL;
	qwglGetCurrentContext		= NULL;
	qwglGetCurrentDC			= NULL;
	qwglGetLayerPaletteEntries	= NULL;
	qwglGetPixelFormat			= NULL;
	qwglGetProcAddress			= NULL;
	qwglMakeCurrent				= NULL;
	qwglRealizeLayerPalette		= NULL;
	qwglSetLayerPaletteEntries	= NULL;
	qwglSetPixelFormat			= NULL;
	qwglShareLists				= NULL;
	qwglSwapBuffers				= NULL;
	qwglSwapLayerBuffers		= NULL;
	qwglUseFontBitmaps			= NULL;
	qwglUseFontOutlines			= NULL;

	qglAccum					= NULL;
	qglAlphaFunc				= NULL;
	qglAreTexturesResident		= NULL;
	qglArrayElement				= NULL;
	qglBegin					= NULL;
	qglBindTexture				= NULL;
	qglBitmap					= NULL;
	qglBlendFunc				= NULL;
	qglCallList					= NULL;
	qglCallLists				= NULL;
	qglClear					= NULL;
	qglClearAccum				= NULL;
	qglClearColor				= NULL;
	qglClearDepth				= NULL;
	qglClearIndex				= NULL;
	qglClearStencil				= NULL;
	qglClipPlane				= NULL;
	qglColor3b					= NULL;
	qglColor3bv					= NULL;
	qglColor3d					= NULL;
	qglColor3dv					= NULL;
	qglColor3f					= NULL;
	qglColor3fv					= NULL;
	qglColor3i					= NULL;
	qglColor3iv					= NULL;
	qglColor3s					= NULL;
	qglColor3sv					= NULL;
	qglColor3ub					= NULL;
	qglColor3ubv				= NULL;
	qglColor3ui					= NULL;
	qglColor3uiv				= NULL;
	qglColor3us					= NULL;
	qglColor3usv				= NULL;
	qglColor4b					= NULL;
	qglColor4bv					= NULL;
	qglColor4d					= NULL;
	qglColor4dv					= NULL;
	qglColor4f					= NULL;
	qglColor4fv					= NULL;
	qglColor4i					= NULL;
	qglColor4iv					= NULL;
	qglColor4s					= NULL;
	qglColor4sv					= NULL;
	qglColor4ub					= NULL;
	qglColor4ubv				= NULL;
	qglColor4ui					= NULL;
	qglColor4uiv				= NULL;
	qglColor4us					= NULL;
	qglColor4usv				= NULL;
	qglColorMask				= NULL;
	qglColorMaterial			= NULL;
	qglColorPointer				= NULL;
	qglCopyPixels				= NULL;
	qglCopyTexImage1D			= NULL;
	qglCopyTexImage2D			= NULL;
	qglCopyTexSubImage1D		= NULL;
	qglCopyTexSubImage2D		= NULL;
	qglCullFace					= NULL;
	qglDeleteLists				= NULL;
	qglDeleteTextures			= NULL;
	qglDepthFunc				= NULL;
	qglDepthMask				= NULL;
	qglDepthRange				= NULL;
	qglDisable					= NULL;
	qglDisableClientState		= NULL;
	qglDrawArrays				= NULL;
	qglDrawBuffer				= NULL;
	qglDrawElements				= NULL;
	qglDrawPixels				= NULL;
	qglEdgeFlag					= NULL;
	qglEdgeFlagPointer			= NULL;
	qglEdgeFlagv				= NULL;
	qglEnable					= NULL;
	qglEnableClientState		= NULL;
	qglEnd						= NULL;
	qglEndList					= NULL;
	qglEvalCoord1d				= NULL;
	qglEvalCoord1dv				= NULL;
	qglEvalCoord1f				= NULL;
	qglEvalCoord1fv				= NULL;
	qglEvalCoord2d				= NULL;
	qglEvalCoord2dv				= NULL;
	qglEvalCoord2f				= NULL;
	qglEvalCoord2fv				= NULL;
	qglEvalMesh1				= NULL;
	qglEvalMesh2				= NULL;
	qglEvalPoint1				= NULL;
	qglEvalPoint2				= NULL;
	qglFeedbackBuffer			= NULL;
	qglFinish					= NULL;
	qglFlush					= NULL;
	qglFogf						= NULL;
	qglFogfv					= NULL;
	qglFogi						= NULL;
	qglFogiv					= NULL;
	qglFrontFace				= NULL;
	qglFrustum					= NULL;
	qglGenLists					= NULL;
	qglGenTextures				= NULL;
	qglGetBooleanv				= NULL;
	qglGetClipPlane				= NULL;
	qglGetDoublev				= NULL;
	qglGetError					= NULL;
	qglGetFloatv				= NULL;
	qglGetIntegerv				= NULL;
	qglGetLightfv				= NULL;
	qglGetLightiv				= NULL;
	qglGetMapdv					= NULL;
	qglGetMapfv					= NULL;
	qglGetMapiv					= NULL;
	qglGetMaterialfv			= NULL;
	qglGetMaterialiv			= NULL;
	qglGetPixelMapfv			= NULL;
	qglGetPixelMapuiv			= NULL;
	qglGetPixelMapusv			= NULL;
	qglGetPointerv				= NULL;
	qglGetPolygonStipple		= NULL;
	qglGetString				= NULL;
	qglGetTexEnvfv				= NULL;
	qglGetTexEnviv				= NULL;
	qglGetTexGendv				= NULL;
	qglGetTexGenfv				= NULL;
	qglGetTexGeniv				= NULL;
	qglGetTexImage				= NULL;
	qglGetTexLevelParameterfv	= NULL;
	qglGetTexLevelParameteriv	= NULL;
	qglGetTexParameterfv		= NULL;
	qglGetTexParameteriv		= NULL;
	qglHint						= NULL;
	qglIndexMask				= NULL;
	qglIndexPointer				= NULL;
	qglIndexd					= NULL;
	qglIndexdv					= NULL;
	qglIndexf					= NULL;
	qglIndexfv					= NULL;
	qglIndexi					= NULL;
	qglIndexiv					= NULL;
	qglIndexs					= NULL;
	qglIndexsv					= NULL;
	qglIndexub					= NULL;
	qglIndexubv					= NULL;
	qglInitNames				= NULL;
	qglInterleavedArrays		= NULL;
	qglIsEnabled				= NULL;
	qglIsList					= NULL;
	qglIsTexture				= NULL;
	qglLightModelf				= NULL;
	qglLightModelfv				= NULL;
	qglLightModeli				= NULL;
	qglLightModeliv				= NULL;
	qglLightf					= NULL;
	qglLightfv					= NULL;
	qglLighti					= NULL;
	qglLightiv					= NULL;
	qglLineStipple				= NULL;
	qglLineWidth				= NULL;
	qglListBase					= NULL;
	qglLoadIdentity				= NULL;
	qglLoadMatrixd				= NULL;
	qglLoadMatrixf				= NULL;
	qglLoadName					= NULL;
	qglLogicOp					= NULL;
	qglMap1d					= NULL;
	qglMap1f					= NULL;
	qglMap2d					= NULL;
	qglMap2f					= NULL;
	qglMapGrid1d				= NULL;
	qglMapGrid1f				= NULL;
	qglMapGrid2d				= NULL;
	qglMapGrid2f				= NULL;
	qglMaterialf				= NULL;
	qglMaterialfv				= NULL;
	qglMateriali				= NULL;
	qglMaterialiv				= NULL;
	qglMatrixMode				= NULL;
	qglMultMatrixd				= NULL;
	qglMultMatrixf				= NULL;
	qglNewList					= NULL;
	qglNormal3b					= NULL;
	qglNormal3bv				= NULL;
	qglNormal3d					= NULL;
	qglNormal3dv				= NULL;
	qglNormal3f					= NULL;
	qglNormal3fv				= NULL;
	qglNormal3i					= NULL;
	qglNormal3iv				= NULL;
	qglNormal3s					= NULL;
	qglNormal3sv				= NULL;
	qglNormalPointer			= NULL;
	qglOrtho					= NULL;
	qglPassThrough				= NULL;
	qglPixelMapfv				= NULL;
	qglPixelMapuiv				= NULL;
	qglPixelMapusv				= NULL;
	qglPixelStoref				= NULL;
	qglPixelStorei				= NULL;
	qglPixelTransferf			= NULL;
	qglPixelTransferi			= NULL;
	qglPixelZoom				= NULL;
	qglPointSize				= NULL;
	qglPolygonMode				= NULL;
	qglPolygonOffset			= NULL;
	qglPolygonStipple			= NULL;
	qglPopAttrib				= NULL;
	qglPopClientAttrib			= NULL;
	qglPopMatrix				= NULL;
	qglPopName					= NULL;
	qglPrioritizeTextures		= NULL;
	qglPushAttrib				= NULL;
	qglPushClientAttrib			= NULL;
	qglPushMatrix				= NULL;
	qglPushName					= NULL;
	qglRasterPos2d				= NULL;
	qglRasterPos2dv				= NULL;
	qglRasterPos2f				= NULL;
	qglRasterPos2fv				= NULL;
	qglRasterPos2i				= NULL;
	qglRasterPos2iv				= NULL;
	qglRasterPos2s				= NULL;
	qglRasterPos2sv				= NULL;
	qglRasterPos3d				= NULL;
	qglRasterPos3dv				= NULL;
	qglRasterPos3f				= NULL;
	qglRasterPos3fv				= NULL;
	qglRasterPos3i				= NULL;
	qglRasterPos3iv				= NULL;
	qglRasterPos3s				= NULL;
	qglRasterPos3sv				= NULL;
	qglRasterPos4d				= NULL;
	qglRasterPos4dv				= NULL;
	qglRasterPos4f				= NULL;
	qglRasterPos4fv				= NULL;
	qglRasterPos4i				= NULL;
	qglRasterPos4iv				= NULL;
	qglRasterPos4s				= NULL;
	qglRasterPos4sv				= NULL;
	qglReadBuffer				= NULL;
	qglReadPixels				= NULL;
	qglRectd					= NULL;
	qglRectdv					= NULL;
	qglRectf					= NULL;
	qglRectfv					= NULL;
	qglRecti					= NULL;
	qglRectiv					= NULL;
	qglRects					= NULL;
	qglRectsv					= NULL;
	qglRenderMode				= NULL;
	qglRotated					= NULL;
	qglRotatef					= NULL;
	qglScaled					= NULL;
	qglScalef					= NULL;
	qglScissor					= NULL;
	qglSelectBuffer				= NULL;
	qglShadeModel				= NULL;
	qglStencilFunc				= NULL;
	qglStencilMask				= NULL;
	qglStencilOp				= NULL;
	qglTexCoord1d				= NULL;
	qglTexCoord1dv				= NULL;
	qglTexCoord1f				= NULL;
	qglTexCoord1fv				= NULL;
	qglTexCoord1i				= NULL;
	qglTexCoord1iv				= NULL;
	qglTexCoord1s				= NULL;
	qglTexCoord1sv				= NULL;
	qglTexCoord2d				= NULL;
	qglTexCoord2dv				= NULL;
	qglTexCoord2f				= NULL;
	qglTexCoord2fv				= NULL;
	qglTexCoord2i				= NULL;
	qglTexCoord2iv				= NULL;
	qglTexCoord2s				= NULL;
	qglTexCoord2sv				= NULL;
	qglTexCoord3d				= NULL;
	qglTexCoord3dv				= NULL;
	qglTexCoord3f				= NULL;
	qglTexCoord3fv				= NULL;
	qglTexCoord3i				= NULL;
	qglTexCoord3iv				= NULL;
	qglTexCoord3s				= NULL;
	qglTexCoord3sv				= NULL;
	qglTexCoord4d				= NULL;
	qglTexCoord4dv				= NULL;
	qglTexCoord4f				= NULL;
	qglTexCoord4fv				= NULL;
	qglTexCoord4i				= NULL;
	qglTexCoord4iv				= NULL;
	qglTexCoord4s				= NULL;
	qglTexCoord4sv				= NULL;
	qglTexCoordPointer			= NULL;
	qglTexEnvf					= NULL;
	qglTexEnvfv					= NULL;
	qglTexEnvi					= NULL;
	qglTexEnviv					= NULL;
	qglTexGend					= NULL;
	qglTexGendv					= NULL;
	qglTexGenf					= NULL;
	qglTexGenfv					= NULL;
	qglTexGeni					= NULL;
	qglTexGeniv					= NULL;
	qglTexImage1D				= NULL;
	qglTexImage2D				= NULL;
	qglTexParameterf			= NULL;
	qglTexParameterfv			= NULL;
	qglTexParameteri			= NULL;
	qglTexParameteriv			= NULL;
	qglTexSubImage1D			= NULL;
	qglTexSubImage2D			= NULL;
	qglTranslated				= NULL;
	qglTranslatef				= NULL;
	qglVertex2d					= NULL;
	qglVertex2dv				= NULL;
	qglVertex2f					= NULL;
	qglVertex2fv				= NULL;
	qglVertex2i					= NULL;
	qglVertex2iv				= NULL;
	qglVertex2s					= NULL;
	qglVertex2sv				= NULL;
	qglVertex3d					= NULL;
	qglVertex3dv				= NULL;
	qglVertex3f					= NULL;
	qglVertex3fv				= NULL;
	qglVertex3i					= NULL;
	qglVertex3iv				= NULL;
	qglVertex3s					= NULL;
	qglVertex3sv				= NULL;
	qglVertex4d					= NULL;
	qglVertex4dv				= NULL;
	qglVertex4f					= NULL;
	qglVertex4fv				= NULL;
	qglVertex4i					= NULL;
	qglVertex4iv				= NULL;
	qglVertex4s					= NULL;
	qglVertex4sv				= NULL;
	qglVertexPointer			= NULL;
	qglViewport					= NULL;

	qglActiveTexture			= NULL;

	qglGenBuffers				= NULL;
	qglDeleteBuffers			= NULL;
	qglBindBuffer				= NULL;
	qglBufferData				= NULL;
	qglBufferSubData			= NULL;
	qglMapBuffer				= NULL;
	qglUnmapBuffer				= NULL;

	qglCreateShader				= NULL;
	qglCreateProgram			= NULL;
	qglDeleteShader				= NULL;
	qglDeleteProgram			= NULL;
	qglGetShaderiv				= NULL;
	qglGetProgramiv				= NULL;
	qglGetShaderInfoLog			= NULL;
	qglGetProgramInfoLog		= NULL;
	qglShaderSource				= NULL;
	qglCompileShader			= NULL;
	qglAttachShader				= NULL;
	qglDetachShader				= NULL;
	qglLinkProgram				= NULL;
	qglUseProgram				= NULL;
	qglVertexAttribPointer		= NULL;
	qglEnableVertexAttribArray	= NULL;
	qglDisableVertexAttribArray	= NULL;
	qglBindAttribLocation		= NULL;
	qglGetAttribLocation		= NULL;
	qglGetActiveUniform			= NULL;
	qglGetUniformLocation		= NULL;
	qglUniform1f				= NULL;
	qglUniform2f				= NULL;
	qglUniform3f				= NULL;
	qglUniform4f				= NULL;
	qglUniform1i				= NULL;
	qglUniform2i				= NULL;
	qglUniform3i				= NULL;
	qglUniform4i				= NULL;
	qglUniform1fv				= NULL;
	qglUniform2fv				= NULL;
	qglUniform3fv				= NULL;
	qglUniform4fv				= NULL;
	qglUniform1iv				= NULL;
	qglUniform2iv				= NULL;
	qglUniform3iv				= NULL;
	qglUniform4iv				= NULL;
	qglUniformMatrix2fv			= NULL;
	qglUniformMatrix3fv			= NULL;
	qglUniformMatrix4fv			= NULL;

	qglStencilFuncSeparate		= NULL;
	qglStencilOpSeparate		= NULL;
	qglStencilMaskSeparate		= NULL;

	qglDepthBoundsEXT			= NULL;

	qwglSwapIntervalEXT			= NULL;
}
